Puntplots

Introductie tot datavisualisatie met Seaborn

Content Team

DataCamp

Wat zijn puntplots?

  • Punten tonen het gemiddelde van een kwantitatieve variabele
  • Verticale lijnen tonen 95%-betrouwbaarheidsintervallen

Puntplot van gemiddelde rekening van rokers vs. niet-rokers

1 Waskom, M. L. (2021). seaborn: statistical data visualization. https://seaborn.pydata.org/
Introductie tot datavisualisatie met Seaborn

Lijndiagram: gemiddeld stikstofdioxide door de tijd Lijndiagram van stikstofdioxide door de tijd

Puntplot: gemiddelde restaurantrekening, rokers vs. niet-rokers Puntplot van gemiddelde rekening van rokers vs. niet-rokers

1 Waskom, M. L. (2021). seaborn: statistical data visualization. https://seaborn.pydata.org/
Introductie tot datavisualisatie met Seaborn

Puntplots vs. lijndiagrammen

Beiden tonen:

  • Gemiddelde van een kwantitatieve variabele
  • 95%-betrouwbaarheidsinterval voor het gemiddelde

Verschillen:

  • Lijndiagram heeft een kwantitatieve variabele (meestal tijd) op de x-as
  • Puntplot heeft een categorische variabele op de x-as
Introductie tot datavisualisatie met Seaborn

Puntplots vs. staafdiagrammen

Beiden tonen:

  • Gemiddelde van een kwantitatieve variabele
  • 95%-betrouwbaarheidsinterval voor het gemiddelde
Introductie tot datavisualisatie met Seaborn

Puntplots vs. staafdiagrammen

Staafdiagram van mannelijkheid met hue

Puntplot van mannelijkheid met hue

Introductie tot datavisualisatie met Seaborn

Een puntplot maken

import matplotlib.pyplot as plt
import seaborn as sns

sns.catplot(x="age", 
            y="masculinity_important", 
            data=masculinity_data,
            hue="feel_masculine",
            kind="point")

plt.show()

Puntplot van mannelijkheid met hue

Introductie tot datavisualisatie met Seaborn

Punten loskoppelen

import matplotlib.pyplot as plt
import seaborn as sns

sns.catplot(x="age", 
            y="masculinity_important", 
            data=masculinity_data,
            hue="feel_masculine",
            kind="point",
            linestyle="none")

plt.show()

Puntplot van mannelijkheid met hue en losgekoppelde punten

Introductie tot datavisualisatie met Seaborn

De mediaan tonen

import matplotlib.pyplot as plt
import seaborn as sns

sns.catplot(x="smoker", 
            y="total_bill", 
            data=tips, 
            kind="point")

plt.show()

Puntplot van gemiddelde totale rekening voor rokers vs. niet-rokers

1 Waskom, M. L. (2021). seaborn: statistical data visualization. https://seaborn.pydata.org/
Introductie tot datavisualisatie met Seaborn

De mediaan tonen

import matplotlib.pyplot as plt
import seaborn as sns
from numpy import median

sns.catplot(x="smoker", 
            y="total_bill", 
            data=tips, 
            kind="point", 
            estimator=median)

plt.show()

Puntplot van mediane totale rekening voor rokers vs. niet-rokers

1 Waskom, M. L. (2021). seaborn: statistical data visualization. https://seaborn.pydata.org/
Introductie tot datavisualisatie met Seaborn

Betrouwbaarheidsintervallen aanpassen

import matplotlib.pyplot as plt
import seaborn as sns

sns.catplot(x="smoker", 
            y="total_bill", 
            data=tips, 
            kind="point",
            capsize=0.2)

plt.show()

Puntplot met uiteinden op betrouwbaarheidsintervallen

1 Waskom, M. L. (2021). seaborn: statistical data visualization. https://seaborn.pydata.org/
Introductie tot datavisualisatie met Seaborn

Betrouwbaarheidsintervallen uitschakelen

import matplotlib.pyplot as plt
import seaborn as sns

sns.catplot(x="smoker", 
            y="total_bill", 
            data=tips, 
            kind="point",
            errorbar=None)

plt.show()

Puntplot zonder betrouwbaarheidsintervallen

1 Waskom, M. L. (2021). seaborn: statistical data visualization. https://seaborn.pydata.org/
Introductie tot datavisualisatie met Seaborn

Laten we oefenen!

Introductie tot datavisualisatie met Seaborn

Preparing Video For Download...