# Draw a nested barplot by species and sexg = sns.catplot( data=df, kind="bar", x="species", y="body_mass_g", hue="sex", errorbar=None, alpha=0.6, dodge=False)
Bar Plot, Sex as Hue
What species and sex combination is the most prevalent?
Which species has the smallest numerical difference between sexes?
Code
# Draw a nested barplot by species and sexg = sns.catplot( data=df, kind="bar", x="species", y="body_mass_g", hue="sex", errorbar=None, alpha=0.6)
Awesome Plots
Strip Plot
Code
g = sns.catplot( data=df, kind="strip", y="species", x="bill_length_mm", hue="sex", aspect=2, alpha=0.6)
Swarm Plot
A swarm plot is a scatter plot with points jittered off the lines for the categorical feature so the points do not overlap.
A swarm plot is useful for small datasets, but with an increasing number of points, the plots get too wide.
Swarm Plot Example
Code
g = sns.swarmplot( data=df, y="species", x="bill_length_mm", hue='sex', alpha=0.6)