MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / test_ecdf

Function test_ecdf

lib/matplotlib/tests/test_axes.py:9894–9916  ·  view source on GitHub ↗
(fig_test, fig_ref)

Source from the content-addressed store, hash-verified

9892
9893@check_figures_equal()
9894def test_ecdf(fig_test, fig_ref):
9895 data = np.array([0, -np.inf, -np.inf, np.inf, 1, 1, 2])
9896 weights = range(len(data))
9897 axs_test = fig_test.subplots(1, 2)
9898 for ax, orientation in zip(axs_test, ["vertical", "horizontal"]):
9899 l0 = ax.ecdf(data, orientation=orientation)
9900 l1 = ax.ecdf("d", "w", data={"d": np.ma.array(data), "w": weights},
9901 orientation=orientation,
9902 complementary=True, compress=True, ls=":")
9903 assert len(l0.get_xdata()) == (~np.isnan(data)).sum() + 1
9904 assert len(l1.get_xdata()) == len({*data[~np.isnan(data)]}) + 1
9905 axs_ref = fig_ref.subplots(1, 2)
9906 axs_ref[0].plot([-np.inf, -np.inf, -np.inf, 0, 1, 1, 2, np.inf],
9907 np.arange(8) / 7, ds="steps-post")
9908 axs_ref[0].plot([-np.inf, 0, 1, 2, np.inf, np.inf],
9909 np.array([21, 20, 18, 14, 3, 0]) / 21,
9910 ds="steps-pre", ls=":")
9911 axs_ref[1].plot(np.arange(8) / 7,
9912 [-np.inf, -np.inf, -np.inf, 0, 1, 1, 2, np.inf],
9913 ds="steps-pre")
9914 axs_ref[1].plot(np.array([21, 20, 18, 14, 3, 0]) / 21,
9915 [-np.inf, 0, 1, 2, np.inf, np.inf],
9916 ds="steps-post", ls=":")
9917
9918
9919def test_ecdf_invalid():

Callers

nothing calls this directly

Calls 4

ecdfMethod · 0.80
subplotsMethod · 0.45
get_xdataMethod · 0.45
plotMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…