Plot a univariate distribution along the x axis:
In [ ]:
import seaborn as sns; sns.set()
penguins = sns.load_dataset("penguins")
sns.ecdfplot(data=penguins, x="flipper_length_mm")
Flip the plot by assigning the data variable to the y axis:
In [ ]:
sns.ecdfplot(data=penguins, y="flipper_length_mm")
If neither x
nor y
is assigned, the dataset is treated as wide-form, and a histogram is drawn for each numeric column:
In [ ]:
sns.ecdfplot(data=penguins.filter(like="culmen_", axis="columns"))
You can also draw multiple histograms from a long-form dataset with hue mapping:
In [ ]:
sns.ecdfplot(data=penguins, x="culmen_length_mm", hue="species")
The default distribution statistic is normalized to show a proportion, but you can show absolute counts instead:
In [ ]:
sns.ecdfplot(data=penguins, x="culmen_length_mm", hue="species", stat="count")
It's also possible to plot the empirical complementary CDF (1 - CDF):
In [ ]:
sns.ecdfplot(data=penguins, x="culmen_length_mm", hue="species", complementary=True)
In [ ]: