Skip to main content
Ctrl+K
You are reading documentation for the unreleased version of Matplotlib. Try searching for the released version of this page instead?
Matplotlib 3.10.1+dfsg1 documentation - Home Matplotlib 3.10.1+dfsg1 documentation - Home
  • Plot types
  • User guide
  • Tutorials
  • Examples
  • Reference
  • Contribute
  • Releases
  • Gitter
  • Discourse
  • GitHub
  • Twitter
  • Plot types
  • User guide
  • Tutorials
  • Examples
  • Reference
  • Contribute
  • Releases
  • Gitter
  • Discourse
  • GitHub
  • Twitter

Section Navigation

  • Pairwise data
  • Statistical distributions
    • hist(x)
    • boxplot(X)
    • errorbar(x, y, yerr, xerr)
    • violinplot(D)
    • eventplot(D)
    • hist2d(x, y)
    • hexbin(x, y, C)
    • pie(x)
    • ecdf(x)
  • Gridded data
  • Irregularly gridded data
  • 3D and volumetric data
  • Plot types
  • Statistical distributions
  • ecdf(x)

Note

Go to the end to download the full example code.

ecdf(x)#

Compute and plot the empirical cumulative distribution function of x.

See ecdf.

ecdf
import matplotlib.pyplot as plt
import numpy as np

plt.style.use('_mpl-gallery')

# make data
np.random.seed(1)
x = 4 + np.random.normal(0, 1.5, 200)

# plot:
fig, ax = plt.subplots()
ax.ecdf(x)
plt.show()

Download Jupyter notebook: ecdf.ipynb

Download Python source code: ecdf.py

Download zipped: ecdf.zip

Gallery generated by Sphinx-Gallery

© Copyright 2002–2012 John Hunter, Darren Dale, Eric Firing, Michael Droettboom and the Matplotlib development team; 2012–2025 The Matplotlib development team.

Created using Sphinx 8.1.3.

Built from 3.10.1+dfsg1.

Built with the PyData Sphinx Theme 0.16.1.