Facetting histograms by subsets of dataΒΆ

../_images/faceted_histogram.png

seaborn components used: set_theme(), load_dataset(), displot()

import seaborn as sns

sns.set_theme(style="darkgrid")
df = sns.load_dataset("penguins")
sns.displot(
    df, x="flipper_length_mm", col="species", row="sex",
    binwidth=3, height=3, facet_kws=dict(margin_titles=True),
)