Titels en labels toevoegen: deel 2

Introductie tot datavisualisatie met Seaborn

Content Team

DataCamp

Een titel toevoegen aan AxesSubplot

FacetGrid
g = sns.catplot(x="Region", 
                y="Birthrate", 
                data=gdp_data, 
                kind="box") 

g.figure.suptitle("New Title", y=1.03)
AxesSubplot
g = sns.boxplot(x="Region", 
                y="Birthrate", 
                data=gdp_data)

g.set_title("New Title", y=1.03)
Introductie tot datavisualisatie met Seaborn

Titels voor subplots

g = sns.catplot(x="Region", 
                y="Birthrate", 
                data=gdp_data, 
                kind="box",
                col="Group") 

Boxplots van geboortecijfer met subgroepen

Introductie tot datavisualisatie met Seaborn

Titels voor subplots

g = sns.catplot(x="Region", 
                y="Birthrate", 
                data=gdp_data, 
                kind="box",
                col="Group") 

g.figure.suptitle("New Title", y=1.03)

Boxplots van geboortecijfer met subgroepen en figuurtitel

Introductie tot datavisualisatie met Seaborn

Titels voor subplots

g = sns.catplot(x="Region", 
                y="Birthrate", 
                data=gdp_data, 
                kind="box",
                col="Group") 

g.figure.suptitle("New Title", 
               y=1.03)

g.set_titles("This is {col_name}")

Boxplots van geboortecijfer met subgroepen en subplot-titels

Introductie tot datavisualisatie met Seaborn

Aslabels toevoegen

g = sns.catplot(x="Region", 
                y="Birthrate", 
                data=gdp_data, 
                kind="box")
`

g.set(xlabel="New X Label", ylabel="New Y Label")
plt.show()

Boxplot van geboortecijfer met aslabels

Introductie tot datavisualisatie met Seaborn

x-as-ticklabels roteren

g = sns.catplot(x="Region", 
                y="Birthrate", 
                data=gdp_data, 
                kind="box")

plt.xticks(rotation=90)
plt.show()

Boxplot van geboortecijfer met gedraaide x-ticklabels

Introductie tot datavisualisatie met Seaborn

Laten we oefenen!

Introductie tot datavisualisatie met Seaborn

Preparing Video For Download...