Introductie tot relationele plots en subplots

Introductie tot datavisualisatie met Seaborn

Content Team

DataCamp

Vragen over kwantitatieve variabelen

Relationele plots

  • Lengte vs. gewicht

Spreidingsplot van lengte versus gewicht

Introductie tot datavisualisatie met Seaborn

Vragen over kwantitatieve variabelen

Relationele plots

  • Lengte vs. gewicht
  • Aantal schoolverzuimen vs. eindcijfer

Spreidingsplot van aantal verzuimen versus eindcijfer

Introductie tot datavisualisatie met Seaborn

Vragen over kwantitatieve variabelen

Relationele plots

  • Lengte vs. gewicht
  • Aantal schoolverzuimen vs. eindcijfer
  • BBP vs. percentage geletterden

Spreidingsplot van BBP versus percentage geletterden

Introductie tot datavisualisatie met Seaborn

Spreidingsplot met hue

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

Spreidingsplot met subplots

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

Kennismaken met relplot()

  • Maak "relationele plots": scatter- of lijngrafieken

Waarom relplot() in plaats van scatterplot()?

  • Met relplot() maak je subplots in één figuur
Introductie tot datavisualisatie met Seaborn

scatterplot() vs. relplot()

Met scatterplot()

import seaborn as sns
import matplotlib.pyplot as plt

sns.scatterplot(x="total_bill", 
                y="tip", 
                data=tips)

plt.show()

Met relplot()

import seaborn as sns
import matplotlib.pyplot as plt

sns.relplot(x="total_bill", 
            y="tip", 
            data=tips,
            kind="scatter")

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

Subplots in kolommen

import seaborn as sns
import matplotlib.pyplot as plt

sns.relplot(x="total_bill", 
            y="tip", 
            data=tips,
            kind="scatter",
            col="smoker")

plt.show()

Spreidingsplot met roker-subplots in kolommen

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

Subplots in rijen

import seaborn as sns
import matplotlib.pyplot as plt

sns.relplot(x="total_bill", 
            y="tip", 
            data=tips,
            kind="scatter",
            row="smoker")

plt.show()

Spreidingsplot met roker-subplots in rijen

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

Subplots in rijen en kolommen

import seaborn as sns
import matplotlib.pyplot as plt

sns.relplot(x="total_bill", 
            y="tip", 
            data=tips,
            kind="scatter",
            col="smoker",
            row="time")

plt.show()

Spreidingsplot met subplots voor roker en tijd

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

Subgroepen per weekdag

Spreidingsplot met dag-subplots in kolommen

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

Kolommen wrappen

import seaborn as sns
import matplotlib.pyplot as plt

sns.relplot(x="total_bill", 
            y="tip", 
            data=tips,
            kind="scatter",
            col="day",
            col_wrap=2)

plt.show()

Spreidingsplot met dag-subplots in kolommen op twee rijen

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

Kolommen ordenen

import seaborn as sns
import matplotlib.pyplot as plt

sns.relplot(x="total_bill", 
            y="tip", 
            data=tips,
            kind="scatter",
            col="day",
            col_wrap=2,
            col_order=["Thur",
                       "Fri",
                       "Sat",
                       "Sun"])

plt.show()

Spreidingsplot met geordende dag-subplots

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...