From 6250bffedf6831c319b09792dd852f6a5490b939 Mon Sep 17 00:00:00 2001 From: rawwash Date: Wed, 29 Nov 2023 10:25:59 -0500 Subject: [PATCH 1/4] added test case for spy plot --- lib/matplotlib/tests/test_datetime.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/tests/test_datetime.py b/lib/matplotlib/tests/test_datetime.py index 316be793e47c..20ec32f8fe10 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -492,11 +492,17 @@ def test_semilogy(self): fig, ax = plt.subplots() ax.semilogy(...) - @pytest.mark.xfail(reason="Test for spy not written yet") @mpl.style.context("default") def test_spy(self): - fig, ax = plt.subplots() - ax.spy(...) + data = np.random.rand(10, 10) + data[data < 0.9] = 0 + fig, ax = plt.subplots() + sp = ax.spy(data) + ax.set_title('Spy Plot Test') + ax.set_xlabel('Column Index') + ax.set_ylabel('Row Index') + assert sp is not None, "Failed to create spy plot" + plt.close(fig) @mpl.style.context("default") def test_stackplot(self): From 88ec98d976bed0835d3b6d8b669458a02d6b43a0 Mon Sep 17 00:00:00 2001 From: rawwash Date: Wed, 29 Nov 2023 16:20:51 -0500 Subject: [PATCH 2/4] adding datetime functionality --- lib/matplotlib/tests/test_datetime.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/matplotlib/tests/test_datetime.py b/lib/matplotlib/tests/test_datetime.py index 20ec32f8fe10..1f90bdcb0361 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -494,15 +494,17 @@ def test_semilogy(self): @mpl.style.context("default") def test_spy(self): + dates = [datetime.datetime.today() - + datetime.timedelta(days=i) for i in range(10)] + formatted_dates = [date.strftime("%Y-%m-%d") for date in dates] data = np.random.rand(10, 10) - data[data < 0.9] = 0 - fig, ax = plt.subplots() - sp = ax.spy(data) - ax.set_title('Spy Plot Test') - ax.set_xlabel('Column Index') - ax.set_ylabel('Row Index') - assert sp is not None, "Failed to create spy plot" - plt.close(fig) + threshold = 0.7 + data = np.where(data > threshold, 1, 0) + plt.figure() + plt.spy(data) + plt.xticks(range(10), formatted_dates, rotation=45) + plt.show() + assert plt.gcf() is not None @mpl.style.context("default") def test_stackplot(self): From 69031efcd7a9239906fc5850ab47ea95a55b54ed Mon Sep 17 00:00:00 2001 From: rawwash Date: Wed, 29 Nov 2023 16:22:03 -0500 Subject: [PATCH 3/4] removing plt.show() --- 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 1f90bdcb0361..024e8741db08 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -503,7 +503,6 @@ def test_spy(self): plt.figure() plt.spy(data) plt.xticks(range(10), formatted_dates, rotation=45) - plt.show() assert plt.gcf() is not None @mpl.style.context("default") From 7bf7d0b5e4d036fa7dc172b0f23d86dc97469aa8 Mon Sep 17 00:00:00 2001 From: rawwash Date: Wed, 29 Nov 2023 16:24:37 -0500 Subject: [PATCH 4/4] removing spy test --- lib/matplotlib/tests/test_datetime.py | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/lib/matplotlib/tests/test_datetime.py b/lib/matplotlib/tests/test_datetime.py index 024e8741db08..4a08059cd313 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -492,19 +492,6 @@ def test_semilogy(self): fig, ax = plt.subplots() ax.semilogy(...) - @mpl.style.context("default") - def test_spy(self): - dates = [datetime.datetime.today() - - datetime.timedelta(days=i) for i in range(10)] - formatted_dates = [date.strftime("%Y-%m-%d") for date in dates] - data = np.random.rand(10, 10) - threshold = 0.7 - data = np.where(data > threshold, 1, 0) - plt.figure() - plt.spy(data) - plt.xticks(range(10), formatted_dates, rotation=45) - assert plt.gcf() is not None - @mpl.style.context("default") def test_stackplot(self): mpl.rcParams["date.converter"] = 'concise' 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