Get startedGet started for free

ECDFs of beak depths

While bee swarm plots are useful, we found that ECDFs are often even better when doing EDA. Plot the ECDFs for the 1975 and 2012 beak depth measurements on the same plot.

For your convenience, the beak depths for the respective years has been stored in the NumPy arrays bd_1975 and bd_2012.

This exercise is part of the course

Statistical Thinking in Python (Part 2)

View Course

Exercise instructions

  • Compute the ECDF for the 1975 and 2012 data.
  • Plot the two ECDFs.
  • Set a 2% margin and add axis labels and a legend to the plot.
  • Hit submit to view the plot!

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Compute ECDFs
x_1975, y_1975 = ____
x_2012, y_2012 = ____

# Plot the ECDFs
_ = plt.____(____, ____, marker='.', linestyle='none')
_ = plt.____(____, ____, marker='.', linestyle='none')

# Set margins
____

# Add axis labels and legend
_ = plt.____('beak depth (mm)')
_ = plt.____('ECDF')
_ = plt.____(('1975', '2012'), loc='lower right')

# Show the plot
plt.show()
Edit and Run Code