diff --git a/lib/matplotlib/tests/test_datetime.py b/lib/matplotlib/tests/test_datetime.py index 316be793e47c..6700369cb2c3 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -508,11 +508,27 @@ def test_stackplot(self): fig, ax = plt.subplots(layout='constrained') ax.stackplot(dates, stacked_nums) - @pytest.mark.xfail(reason="Test for stairs not written yet") @mpl.style.context("default") def test_stairs(self): - fig, ax = plt.subplots() - ax.stairs(...) + mpl.rcParams["date.converter"] = 'concise' + + start_date = datetime.datetime(2023, 12, 1) + time_delta = datetime.timedelta(days=1) + baseline_date = datetime.datetime(1980, 1, 1) + + bin_edges = [start_date + i * time_delta for i in range(31)] + edge_int = np.arange(31) + np.random.seed(123456) + values1 = np.random.randint(1, 100, 30) + values2 = [start_date + datetime.timedelta(days=int(i)) + for i in np.random.randint(1, 10000, 30)] + values3 = [start_date + datetime.timedelta(days=int(i)) + for i in np.random.randint(-10000, 10000, 30)] + + fig, (ax1, ax2, ax3) = plt.subplots(3, 1, constrained_layout=True) + ax1.stairs(values1, edges=bin_edges) + ax2.stairs(values2, edges=edge_int, baseline=baseline_date) + ax3.stairs(values3, edges=bin_edges, baseline=baseline_date) @pytest.mark.xfail(reason="Test for stem not written yet") @mpl.style.context("default") pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy