Skip to content

stat_ecdf

stat_ecdf(
    mapping: FeatureSpec | None = None,
    *,
    data: PlotData | None = None,
    geom: str | None = None,
    position: Position | None = None,
    show_legend: bool | None = None,
    inherit_aes: bool | None = None,
    sampling: Sampling | None = None,
    tooltips: Tooltips | None = None,
    orientation: str | None = None,
    n: int | None = None,
    pad: bool | None = None,
    color_by: str | None = None,
    na_rm: bool | None = None,
    **other_args: Any,
) -> LayerSpec

Empirical cumulative distribution of x (stat="ecdf"), drawn as steps.

Per group, y is the share of x values at or below each x.

Parameters:

  • mapping (FeatureSpec, default: None ) –

    Aesthetic mapping from aes().

  • data (DataFrame or dict, default: None ) –

    Layer data; inherits the plot data when None.

  • geom (str, default: "step" ) –

    Geom that draws the distribution, e.g. "point" or "line".

  • position (str or FeatureSpec, default: None ) –

    Position adjustment: a name such as "dodge" or a position_*() spec.

  • show_legend (bool, default: None ) –

    False hides this layer from the legend.

  • inherit_aes (bool, default: None ) –

    False ignores the plot's default mapping for this layer.

  • sampling (str or FeatureSpec, default: None ) –

    lets_plot sampling; accepted and ignored, as ggrust draws every row.

  • tooltips (FeatureSpec or list of str, default: None ) –

    Tooltip content: layer_tooltips(), a list of column names, or "none" to disable tooltips (HTML output).

  • orientation (str, default: None ) –

    "y" uses y instead of x.

  • n (int, default: None ) –

    Number of evenly spaced points from the smallest to the largest x; None uses every distinct x.

  • pad (bool, default: True ) –

    Add (-inf, 0) and (inf, 1), so steps run to the panel edges.

  • color_by (str, default: None ) –

    Aesthetic the color scale applies to ("color" or "fill").

  • na_rm (bool, default: None ) –

    True removes rows with missing values silently; otherwise they are removed with a warning.

  • **other_args (Any) –

    Constant aesthetics such as color="red", and the geom's options.

Returns:

  • LayerSpec –

    The layer.

Examples:

>>> from ggrust import *
>>> data = {"minutes": [12, 15, 15, 21, 30, 34, 41], "team": list("aabbaba")}
>>> plot = ggplot(data, aes("minutes", color="team")) + stat_ecdf()