.ecdf()
Anonymous contributor
Published Feb 23, 2025
Contribute to Docs
In Plotly, the .ecdf()
function under the plotly.express
module is used to generate an Empirical Cumulative Distribution Function (ECDF) plot. An ECDF plot visualizes the proportion or count of observations that are less than or equal to a given value, making it useful for analyzing distributions of data without assuming an underlying probability distribution.
Syntax
plotly.express.ecdf(data_frame=None, x=None, y=None, color=None, orientation=None, markers=False, ...)
data_frame
: The Pandas DataFrame containing the data.x
: The column to be plotted on the x-axis.y
(Optional): The column to be plotted on the y-axis.color
(Optional): The column name for grouping data by different colors.orientation
(Optional): Defines the orientation of the ECDF plot. The available options arev
(vertical) andh
(horizontal).markers
(Optional): IfTrue
, shows markers at each data point.
Note: The ellipsis (…) indicates that there can be additional optional parameters beyond those listed here.
Example
The following example demonstrates the usage of the .ecdf()
function:
import plotly.express as pximport pandas as pd# Create a sample datasetdata = pd.DataFrame({"values": [3, 7, 8, 5, 12, 14, 18, 21, 25, 30]})# Create an ECDF plotplot = px.ecdf(data, x="values", markers=True)# Display the ECDF plotplot.show()
The above code produces the following output:
All contributors
- Anonymous contributor
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn Python:Plotly on Codecademy
- Career path
Computer Science
Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!Includes 6 CoursesWith Professional CertificationBeginner Friendly75 hours - Course
Learn Python 3
Learn the basics of Python 3.12, one of the most powerful, versatile, and in-demand programming languages today.With CertificateBeginner Friendly23 hours