plotly.express
.ecdf¶
-
plotly.express.
ecdf
(data_frame=None, x=None, y=None, color=None, text=None, line_dash=None, symbol=None, facet_row=None, facet_col=None, facet_col_wrap=0, facet_row_spacing=None, facet_col_spacing=None, hover_name=None, hover_data=None, animation_frame=None, animation_group=None, markers=False, lines=True, category_orders=None, labels=None, color_discrete_sequence=None, color_discrete_map=None, line_dash_sequence=None, line_dash_map=None, symbol_sequence=None, symbol_map=None, marginal=None, opacity=None, orientation=None, ecdfnorm='probability', ecdfmode='standard', render_mode='auto', log_x=False, log_y=False, range_x=None, range_y=None, title=None, template=None, width=None, height=None) → plotly.graph_objects._figure.Figure¶ In a Empirical Cumulative Distribution Function (ECDF) plot, rows of
data_frame
are sorted by the valuex
(ory
iforientation
is'h'
) and their cumulative count (or the cumulative sum ofy
if supplied andorientation
ish
) is drawn as a line.- Parameters
data_frame (DataFrame or array-like or dict) – This argument needs to be passed for column names (and not keyword names) to be used. Array-like and dict are transformed internally to a pandas DataFrame. Optional: if missing, a DataFrame gets constructed under the hood using the other arguments.
x (str or int or Series or array-like) – Either a name of a column in
data_frame
, or a pandas Series or array_like object. Values from this column or array_like are used to position marks along the x axis in cartesian coordinates. Iforientation
is'h'
, the cumulative sum of this argument is plotted rather than the cumulative count. Eitherx
ory
can optionally be a list of column references or array_likes, in which case the data will be treated as if it were ‘wide’ rather than ‘long’.y (str or int or Series or array-like) – Either a name of a column in
data_frame
, or a pandas Series or array_like object. Values from this column or array_like are used to position marks along the y axis in cartesian coordinates. Iforientation
is'v'
, the cumulative sum of this argument is plotted rather than the cumulative count. Eitherx
ory
can optionally be a list of column references or array_likes, in which case the data will be treated as if it were ‘wide’ rather than ‘long’.color (str or int or Series or array-like) – Either a name of a column in
data_frame
, or a pandas Series or array_like object. Values from this column or array_like are used to assign color to marks.text (str or int or Series or array-like) – Either a name of a column in
data_frame
, or a pandas Series or array_like object. Values from this column or array_like appear in the figure as text labels.line_dash (str or int or Series or array-like) – Either a name of a column in
data_frame
, or a pandas Series or array_like object. Values from this column or array_like are used to assign dash-patterns to lines.symbol (str or int or Series or array-like) – Either a name of a column in
data_frame
, or a pandas Series or array_like object. Values from this column or array_like are used to assign symbols to marks.facet_row (str or int or Series or array-like) – Either a name of a column in
data_frame
, or a pandas Series or array_like object. Values from this column or array_like are used to assign marks to facetted subplots in the vertical direction.facet_col (str or int or Series or array-like) – Either a name of a column in
data_frame
, or a pandas Series or array_like object. Values from this column or array_like are used to assign marks to facetted subplots in the horizontal direction.facet_col_wrap (int) – Maximum number of facet columns. Wraps the column variable at this width, so that the column facets span multiple rows. Ignored if 0, and forced to 0 if
facet_row
or amarginal
is set.facet_row_spacing (float between 0 and 1) – Spacing between facet rows, in paper units. Default is 0.03 or 0.07 when facet_col_wrap is used.
facet_col_spacing (float between 0 and 1) – Spacing between facet columns, in paper units Default is 0.02.
hover_name (str or int or Series or array-like) – Either a name of a column in
data_frame
, or a pandas Series or array_like object. Values from this column or array_like appear in bold in the hover tooltip.hover_data (str, or list of str or int, or Series or array-like, or dict) – Either a name or list of names of columns in
data_frame
, or pandas Series, or array_like objects or a dict with column names as keys, with values True (for default formatting) False (in order to remove this column from hover information), or a formatting string, for example ‘:.3f’ or ‘|%a’ or list-like data to appear in the hover tooltip or tuples with a bool or formatting string as first element, and list-like data to appear in hover as second element Values from these columns appear as extra data in the hover tooltip.animation_frame (str or int or Series or array-like) – Either a name of a column in
data_frame
, or a pandas Series or array_like object. Values from this column or array_like are used to assign marks to animation frames.animation_group (str or int or Series or array-like) – Either a name of a column in
data_frame
, or a pandas Series or array_like object. Values from this column or array_like are used to provide object-constancy across animation frames: rows with matching `animation_group`s will be treated as if they describe the same object in each frame.markers (boolean (default
False
)) – IfTrue
, markers are shown on lines.lines (boolean (default
True
)) – IfFalse
, lines are not drawn (forced toTrue
ifmarkers
isFalse
).category_orders (dict with str keys and list of str values (default
{}
)) – By default, in Python 3.6+, the order of categorical values in axes, legends and facets depends on the order in which these values are first encountered indata_frame
(and no order is guaranteed by default in Python below 3.6). This parameter is used to force a specific ordering of values per column. The keys of this dict should correspond to column names, and the values should be lists of strings corresponding to the specific display order desired.labels (dict with str keys and str values (default
{}
)) – By default, column names are used in the figure for axis titles, legend entries and hovers. This parameter allows this to be overridden. The keys of this dict should correspond to column names, and the values should correspond to the desired label to be displayed.color_discrete_sequence (list of str) – Strings should define valid CSS-colors. When
color
is set and the values in the corresponding column are not numeric, values in that column are assigned colors by cycling throughcolor_discrete_sequence
in the order described incategory_orders
, unless the value ofcolor
is a key incolor_discrete_map
. Various useful color sequences are available in theplotly.express.colors
submodules, specificallyplotly.express.colors.qualitative
.color_discrete_map (dict with str keys and str values (default
{}
)) – String values should define valid CSS-colors Used to overridecolor_discrete_sequence
to assign a specific colors to marks corresponding with specific values. Keys incolor_discrete_map
should be values in the column denoted bycolor
. Alternatively, if the values ofcolor
are valid colors, the string'identity'
may be passed to cause them to be used directly.line_dash_sequence (list of str) – Strings should define valid plotly.js dash-patterns. When
line_dash
is set, values in that column are assigned dash-patterns by cycling throughline_dash_sequence
in the order described incategory_orders
, unless the value ofline_dash
is a key inline_dash_map
.line_dash_map (dict with str keys and str values (default
{}
)) – Strings values define plotly.js dash-patterns. Used to overrideline_dash_sequences
to assign a specific dash-patterns to lines corresponding with specific values. Keys inline_dash_map
should be values in the column denoted byline_dash
. Alternatively, if the values ofline_dash
are valid line-dash names, the string'identity'
may be passed to cause them to be used directly.symbol_sequence (list of str) – Strings should define valid plotly.js symbols. When
symbol
is set, values in that column are assigned symbols by cycling throughsymbol_sequence
in the order described incategory_orders
, unless the value ofsymbol
is a key insymbol_map
.symbol_map (dict with str keys and str values (default
{}
)) – String values should define plotly.js symbols Used to overridesymbol_sequence
to assign a specific symbols to marks corresponding with specific values. Keys insymbol_map
should be values in the column denoted bysymbol
. Alternatively, if the values ofsymbol
are valid symbol names, the string'identity'
may be passed to cause them to be used directly.marginal (str) – One of
'rug'
,'box'
,'violin'
, or'histogram'
. If set, a subplot is drawn alongside the main plot, visualizing the distribution.opacity (float) – Value between 0 and 1. Sets the opacity for markers.
orientation (str, one of
'h'
for horizontal or'v'
for vertical.) – (default'v'
ifx
andy
are provided and both continous or both categorical, otherwise'v'`(
‘h’) if `x`(`y
) is categorical andy`(`x
) is continuous, otherwise'v'`(
‘h’) if only `x`(`y
) is provided)ecdfnorm (string or
None
(default'probability'
)) – One of'probability'
or'percent'
IfNone
, values will be raw counts or sums. If `’probability’, values will be probabilities normalized from 0 to 1. If `’percent’, values will be percentages normalized from 0 to 100.ecdfmode (string (default
'standard'
)) – One of'standard'
,'complementary'
or'reversed'
If'standard'
, the ECDF is plotted such that values represent data at or below the point. If'complementary'
, the CCDF is plotted such that values represent data above the point. If'reversed'
, a variant of the CCDF is plotted such that values represent data at or above the point.render_mode (str) – One of
'auto'
,'svg'
or'webgl'
, default'auto'
Controls the browser API used to draw marks.'svg'
is appropriate for figures of less than 1000 data points, and will allow for fully-vectorized output.'webgl'
is likely necessary for acceptable performance above 1000 points but rasterizes part of the output.'auto'
uses heuristics to choose the mode.log_x (boolean (default
False
)) – IfTrue
, the x-axis is log-scaled in cartesian coordinates.log_y (boolean (default
False
)) – IfTrue
, the y-axis is log-scaled in cartesian coordinates.range_x (list of two numbers) – If provided, overrides auto-scaling on the x-axis in cartesian coordinates.
range_y (list of two numbers) – If provided, overrides auto-scaling on the y-axis in cartesian coordinates.
title (str) – The figure title.
template (str or dict or plotly.graph_objects.layout.Template instance) – The figure template name (must be a key in plotly.io.templates) or definition.
width (int (default
None
)) – The figure width in pixels.height (int (default
None
)) – The figure height in pixels.
- Returns
- Return type