Titels en labels toevoegen: deel 1

Introductie tot datavisualisatie met Seaborn

Content Team

DataCamp

Informatieve visualisaties maken

Boxplot van geboortecijfer per regio

Boxplot van geboortecijfer per regio met titel en labels

Introductie tot datavisualisatie met Seaborn

FacetGrid vs. AxesSubplot-objecten

Seaborn-plots maken twee objecttypen: FacetGrid en AxesSubplot

g = sns.scatterplot(x="height", y="weight", data=df)

type(g)
> matplotlib.axes._subplots.AxesSubplot
Introductie tot datavisualisatie met Seaborn

Een lege FacetGrid

Lege 4x4 FacetGrid

Introductie tot datavisualisatie met Seaborn

FacetGrid vs. AxesSubplot-objecten

Objecttype Plottypen Kenmerken
FacetGrid relplot(), catplot() Kan subplotten maken
AxesSubplot scatterplot(), countplot(), enz. Maakt slechts één plot
Introductie tot datavisualisatie met Seaborn

Een titel toevoegen aan FacetGrid

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

g.figure.suptitle("New Title")
plt.show()

Boxplot van geboortecijfer met toegevoegde titel

Introductie tot datavisualisatie met Seaborn

Titelhoogte aanpassen in FacetGrid

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

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

plt.show()

Geboortecijfer-plot met hogere titel

Introductie tot datavisualisatie met Seaborn

Laten we oefenen!

Introductie tot datavisualisatie met Seaborn

Preparing Video For Download...