ECDF Plots

Learn how to plot, design, and interpret ECDF plots for data visualizations.

Overview

The term ECDF stands for the empirical cumulative distribution function. An ECDF plot represents the percentage or number of observations in a dataset that fall below each distinct value. Although the measures of central tendency are less evident from the plot, an ECDF plot allows us to compare the distributions of many variables.

Plotting an ECDF plot

Let’s get started by importing the required libraries and the mpg dataset. We plot an ECDF plot by passing x='displacement' in the sns.ecdfplot() function. The ECDF plot shows the distribution of the displacement variable of the mpg dataset. We can observe that around 70% of the cars have displacement below 300.

Press + to interact
sns.ecdfplot(x='displacement', data= mpg_df) #uni modal
plt.savefig('output/graph.png')

By default, the ECDF plot shows the proportion of each observation. However, we can switch it to display ...