Compute and plot the empirical cumulative distribution function of *x*. .. versionadded:: 3.8 Parameters ---------- x : 1d array-like The input data. Infinite entries are kept (and move the relevant end of the ecdf from 0/1), but Na
(self, x, weights=None, *, complementary=False,
orientation="vertical", compress=False, **kwargs)
| 7901 | @_preprocess_data(replace_names=["x", "weights"], label_namer="x") |
| 7902 | @_docstring.interpd |
| 7903 | def ecdf(self, x, weights=None, *, complementary=False, |
| 7904 | orientation="vertical", compress=False, **kwargs): |
| 7905 | """ |
| 7906 | Compute and plot the empirical cumulative distribution function of *x*. |
| 7907 | |
| 7908 | .. versionadded:: 3.8 |
| 7909 | |
| 7910 | Parameters |
| 7911 | ---------- |
| 7912 | x : 1d array-like |
| 7913 | The input data. Infinite entries are kept (and move the relevant |
| 7914 | end of the ecdf from 0/1), but NaNs and masked values are errors. |
| 7915 | |
| 7916 | weights : 1d array-like or None, default: None |
| 7917 | The weights of the entries; must have the same shape as *x*. |
| 7918 | Weights corresponding to NaN data points are dropped, and then the |
| 7919 | remaining weights are normalized to sum to 1. If unset, all |
| 7920 | entries have the same weight. |
| 7921 | |
| 7922 | complementary : bool, default: False |
| 7923 | Whether to plot a cumulative distribution function, which increases |
| 7924 | from 0 to 1 (the default), or a complementary cumulative |
| 7925 | distribution function, which decreases from 1 to 0. |
| 7926 | |
| 7927 | orientation : {"vertical", "horizontal"}, default: "vertical" |
| 7928 | Whether the entries are plotted along the x-axis ("vertical", the |
| 7929 | default) or the y-axis ("horizontal"). This parameter takes the |
| 7930 | same values as in `~.Axes.hist`. |
| 7931 | |
| 7932 | compress : bool, default: False |
| 7933 | Whether multiple entries with the same values are grouped together |
| 7934 | (with a summed weight) before plotting. This is mainly useful if |
| 7935 | *x* contains many identical data points, to decrease the rendering |
| 7936 | complexity of the plot. If *x* contains no duplicate points, this |
| 7937 | has no effect and just uses some time and memory. |
| 7938 | |
| 7939 | Other Parameters |
| 7940 | ---------------- |
| 7941 | data : indexable object, optional |
| 7942 | DATA_PARAMETER_PLACEHOLDER |
| 7943 | |
| 7944 | **kwargs |
| 7945 | Keyword arguments control the `.Line2D` properties: |
| 7946 | |
| 7947 | %(Line2D:kwdoc)s |
| 7948 | |
| 7949 | Returns |
| 7950 | ------- |
| 7951 | `.Line2D` |
| 7952 | |
| 7953 | Notes |
| 7954 | ----- |
| 7955 | The ecdf plot can be thought of as a cumulative histogram with one bin |
| 7956 | per data entry; i.e. it reports on the entire dataset without any |
| 7957 | arbitrary binning. |
| 7958 | |
| 7959 | If *x* contains NaNs or masked entries, either remove them first from |
| 7960 | the array (if they should not taken into account), or replace them by |