From b9db8abe70efc92287e9b639a1c8021fd3f1d29a Mon Sep 17 00:00:00 2001 From: Junpei Ota Date: Wed, 18 Oct 2023 03:08:53 -0400 Subject: [PATCH 1/7] Added smoke test for Axes.stem --- lib/matplotlib/tests/test_datetime.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/tests/test_datetime.py b/lib/matplotlib/tests/test_datetime.py index f42e0a0d04d8..2438ae74470a 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -337,11 +337,22 @@ def test_stairs(self): fig, ax = plt.subplots() ax.stairs(...) - @pytest.mark.xfail(reason="Test for stem not written yet") @mpl.style.context("default") def test_stem(self): - fig, ax = plt.subplots() - ax.stem(...) + mpl.rcParams["date.converter"] = "concise" + + limit_value = 10 + fig, (ax1, ax2, ax3) = plt.subplots(3, 1, layout="constrained") + + x_range = np.array(range(1, limit_value)) + y_range = np.array(range(1, limit_value)) + + x_dates = np.array([datetime.datetime(2023, 10, date) for date in range(1, limit_value)]) + y_dates = np.array([datetime.datetime(2023, 10, date) for date in range(1, limit_value)]) + + ax1.stem(x_dates, y_dates) + ax2.stem(x_dates, y_range) + ax3.stem(x_range, y_dates) @pytest.mark.xfail(reason="Test for step not written yet") @mpl.style.context("default") From 83ce6c3817c30a06baaccc211c32add3a9d5d6c6 Mon Sep 17 00:00:00 2001 From: Junpei Ota Date: Wed, 18 Oct 2023 20:52:40 -0400 Subject: [PATCH 2/7] Updates to include bottom and orientation --- lib/matplotlib/tests/test_datetime.py | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/lib/matplotlib/tests/test_datetime.py b/lib/matplotlib/tests/test_datetime.py index 2438ae74470a..a0035b419ccb 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -274,20 +274,29 @@ def test_plot(self): def test_plot_date(self): mpl.rcParams["date.converter"] = "concise" range_threshold = 10 - fig, (ax1, ax2, ax3) = plt.subplots(3, 1, layout="constrained") + fig, (ax1, ax2, ax3, ax4, ax5, ax6) = plt.subplots(6, 1, layout="constrained") + + limit_value = 10 + above = datetime.datetime(2100, 10, 18) + below = datetime.datetime(1900, 10, 18) + + x_ranges = np.array(range(1, limit_value)) + y_ranges = np.array(range(1, limit_value)) x_dates = np.array( - [datetime.datetime(2023, 10, delta) for delta in range(1, range_threshold)] + [datetime.datetime(2023, 10, n) for n in range(1, limit_value)] ) y_dates = np.array( - [datetime.datetime(2023, 10, delta) for delta in range(1, range_threshold)] + [datetime.datetime(2023, 10, n) for n in range(1, limit_value)] ) - x_ranges = np.array(range(1, range_threshold)) - y_ranges = np.array(range(1, range_threshold)) - ax1.plot_date(x_dates, y_dates) - ax2.plot_date(x_dates, y_ranges) - ax3.plot_date(x_ranges, y_dates) + ax1.stem(x_dates, y_dates, bottom = above) + ax2.stem(x_dates, y_ranges, bottom = 5) + ax3.stem(x_ranges, y_dates, bottom = below) + + ax4.stem(x_ranges, y_dates, orientation="horizontal", bottom=above) + ax5.stem(x_dates, y_ranges, orientation="horizontal", bottom=5) + ax6.stem(x_ranges, y_dates, orientation="horizontal", bottom=below) @pytest.mark.xfail(reason="Test for quiver not written yet") @mpl.style.context("default") @@ -340,7 +349,6 @@ def test_stairs(self): @mpl.style.context("default") def test_stem(self): mpl.rcParams["date.converter"] = "concise" - limit_value = 10 fig, (ax1, ax2, ax3) = plt.subplots(3, 1, layout="constrained") From a8c87191117491488b0d82f90379d256ddf3a068 Mon Sep 17 00:00:00 2001 From: Junpei Ota Date: Thu, 19 Oct 2023 01:18:36 -0400 Subject: [PATCH 3/7] Move code to stem function --- lib/matplotlib/tests/test_datetime.py | 55 ++++++++++++++------------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/lib/matplotlib/tests/test_datetime.py b/lib/matplotlib/tests/test_datetime.py index a0035b419ccb..a185949631cf 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -274,29 +274,20 @@ def test_plot(self): def test_plot_date(self): mpl.rcParams["date.converter"] = "concise" range_threshold = 10 - fig, (ax1, ax2, ax3, ax4, ax5, ax6) = plt.subplots(6, 1, layout="constrained") - - limit_value = 10 - above = datetime.datetime(2100, 10, 18) - below = datetime.datetime(1900, 10, 18) - - x_ranges = np.array(range(1, limit_value)) - y_ranges = np.array(range(1, limit_value)) + fig, (ax1, ax2, ax3) = plt.subplots(3, 1, layout="constrained") x_dates = np.array( - [datetime.datetime(2023, 10, n) for n in range(1, limit_value)] + [datetime.datetime(2023, 10, delta) for delta in range(1, range_threshold)] ) y_dates = np.array( - [datetime.datetime(2023, 10, n) for n in range(1, limit_value)] + [datetime.datetime(2023, 10, delta) for delta in range(1, range_threshold)] ) - - ax1.stem(x_dates, y_dates, bottom = above) - ax2.stem(x_dates, y_ranges, bottom = 5) - ax3.stem(x_ranges, y_dates, bottom = below) - - ax4.stem(x_ranges, y_dates, orientation="horizontal", bottom=above) - ax5.stem(x_dates, y_ranges, orientation="horizontal", bottom=5) - ax6.stem(x_ranges, y_dates, orientation="horizontal", bottom=below) + x_ranges = np.array(range(1, range_threshold)) + y_ranges = np.array(range(1, range_threshold)) + + ax1.plot_date(x_dates, y_dates) + ax2.plot_date(x_dates, y_ranges) + ax3.plot_date(x_ranges, y_dates) @pytest.mark.xfail(reason="Test for quiver not written yet") @mpl.style.context("default") @@ -349,18 +340,30 @@ def test_stairs(self): @mpl.style.context("default") def test_stem(self): mpl.rcParams["date.converter"] = "concise" + range_threshold = 10 + fig, (ax1, ax2, ax3, ax4, ax5, ax6) = plt.subplots(6, 1, layout="constrained") + limit_value = 10 - fig, (ax1, ax2, ax3) = plt.subplots(3, 1, layout="constrained") + above = datetime.datetime(2100, 10, 18) + below = datetime.datetime(1900, 10, 18) + + x_ranges = np.array(range(1, limit_value)) + y_ranges = np.array(range(1, limit_value)) - x_range = np.array(range(1, limit_value)) - y_range = np.array(range(1, limit_value)) + x_dates = np.array( + [datetime.datetime(2023, 10, n) for n in range(1, limit_value)] + ) + y_dates = np.array( + [datetime.datetime(2023, 10, n) for n in range(1, limit_value)] + ) - x_dates = np.array([datetime.datetime(2023, 10, date) for date in range(1, limit_value)]) - y_dates = np.array([datetime.datetime(2023, 10, date) for date in range(1, limit_value)]) + ax1.stem(x_dates, y_dates, bottom=above) + ax2.stem(x_dates, y_ranges, bottom=5) + ax3.stem(x_ranges, y_dates, bottom=below) - ax1.stem(x_dates, y_dates) - ax2.stem(x_dates, y_range) - ax3.stem(x_range, y_dates) + ax4.stem(x_ranges, y_dates, orientation="horizontal", bottom=above) + ax5.stem(x_dates, y_ranges, orientation="horizontal", bottom=5) + ax6.stem(x_ranges, y_dates, orientation="horizontal", bottom=below) @pytest.mark.xfail(reason="Test for step not written yet") @mpl.style.context("default") From 56e0b8a263f76207949f598d202472c535107504 Mon Sep 17 00:00:00 2001 From: Junpei Ota Date: Thu, 19 Oct 2023 01:27:36 -0400 Subject: [PATCH 4/7] Remove whitespace --- lib/matplotlib/tests/test_datetime.py | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/matplotlib/tests/test_datetime.py b/lib/matplotlib/tests/test_datetime.py index a185949631cf..185df3d77c36 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -284,7 +284,6 @@ def test_plot_date(self): ) x_ranges = np.array(range(1, range_threshold)) y_ranges = np.array(range(1, range_threshold)) - ax1.plot_date(x_dates, y_dates) ax2.plot_date(x_dates, y_ranges) ax3.plot_date(x_ranges, y_dates) From fc8aeb290edf701a016fc2b03ebe1880cbc2cc6c Mon Sep 17 00:00:00 2001 From: Junpei Ota Date: Tue, 24 Oct 2023 20:36:38 -0400 Subject: [PATCH 5/7] Changed dates --- lib/matplotlib/tests/test_datetime.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/tests/test_datetime.py b/lib/matplotlib/tests/test_datetime.py index 185df3d77c36..843b87a99dcd 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -343,8 +343,8 @@ def test_stem(self): fig, (ax1, ax2, ax3, ax4, ax5, ax6) = plt.subplots(6, 1, layout="constrained") limit_value = 10 - above = datetime.datetime(2100, 10, 18) - below = datetime.datetime(1900, 10, 18) + above = datetime.datetime(2023, 9, 18) + below = datetime.datetime(2023, 11, 18) x_ranges = np.array(range(1, limit_value)) y_ranges = np.array(range(1, limit_value)) From ea33f2d9e98c0a7678f1c74283a8153cbbad7cd8 Mon Sep 17 00:00:00 2001 From: Junpei Ota Date: Fri, 27 Oct 2023 00:17:33 -0400 Subject: [PATCH 6/7] Formatting Fixes --- lib/matplotlib/tests/test_datetime.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/tests/test_datetime.py b/lib/matplotlib/tests/test_datetime.py index 843b87a99dcd..429a8fcdbdcf 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -284,6 +284,7 @@ def test_plot_date(self): ) x_ranges = np.array(range(1, range_threshold)) y_ranges = np.array(range(1, range_threshold)) + ax1.plot_date(x_dates, y_dates) ax2.plot_date(x_dates, y_ranges) ax3.plot_date(x_ranges, y_dates) @@ -346,8 +347,8 @@ def test_stem(self): above = datetime.datetime(2023, 9, 18) below = datetime.datetime(2023, 11, 18) - x_ranges = np.array(range(1, limit_value)) - y_ranges = np.array(range(1, limit_value)) + x_ranges = np.arange(1, limit_value) + y_ranges = np.arange(1, limit_value) x_dates = np.array( [datetime.datetime(2023, 10, n) for n in range(1, limit_value)] From 73d917f1692a7c9f1223fcf054839402a8f0f879 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 5 Dec 2023 13:52:00 -0500 Subject: [PATCH 7/7] Remove unused variable --- lib/matplotlib/tests/test_datetime.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/tests/test_datetime.py b/lib/matplotlib/tests/test_datetime.py index 429a8fcdbdcf..4777315dff42 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -340,7 +340,7 @@ def test_stairs(self): @mpl.style.context("default") def test_stem(self): mpl.rcParams["date.converter"] = "concise" - range_threshold = 10 + fig, (ax1, ax2, ax3, ax4, ax5, ax6) = plt.subplots(6, 1, layout="constrained") limit_value = 10 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