From 6571e6548e52b8292e40bfb2c7a2090be9aca18a Mon Sep 17 00:00:00 2001 From: Ethan Zheng <77181471+EthanZheng11@users.noreply.github.com> Date: Sat, 9 Dec 2023 23:05:57 +0000 Subject: [PATCH 1/5] Added datetime test for tricontourf. --- lib/matplotlib/tests/test_datetime.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/tests/test_datetime.py b/lib/matplotlib/tests/test_datetime.py index 3c8cc8b5b8bb..227c94c0cd91 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -737,8 +737,26 @@ def test_tricontour(self): @pytest.mark.xfail(reason="Test for tricontourf not written yet") @mpl.style.context("default") def test_tricontourf(self): + mpl.rcParams["date.converter"] = "concise" fig, ax = plt.subplots() - ax.tricontourf(...) + + np.random.seed(11) + limit_value = 30 + test_date = datetime.datetime(2023, 10, 1) + + x_dates = np.array( + [datetime.datetime(2023, 10, n) for n in range(1, limit_value)] + ) + + x_dates_converted = mpl.dates.date2num(x_dates) + + y_data = np.random.rand(limit_value - 1) + + z_data = np.sin(x_dates_converted) + np.cos(y_data) + + triangulation = mpl.tri.Triangulation(x_dates_converted, y_data) + + ax.tricontourf(triangulation, z_data) @pytest.mark.xfail(reason="Test for tripcolor not written yet") @mpl.style.context("default") From 67b567d4254b0fdd740f277524c53bc003e69c15 Mon Sep 17 00:00:00 2001 From: Ethan Zheng <77181471+EthanZheng11@users.noreply.github.com> Date: Sat, 9 Dec 2023 23:07:24 +0000 Subject: [PATCH 2/5] Removed pytest mark xfail from tricontourf test. --- 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 227c94c0cd91..4d6a387e851e 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -734,7 +734,6 @@ def test_tricontour(self): fig, ax = plt.subplots() ax.tricontour(...) - @pytest.mark.xfail(reason="Test for tricontourf not written yet") @mpl.style.context("default") def test_tricontourf(self): mpl.rcParams["date.converter"] = "concise" From e594dd37b1c64ed06958f141d5568d3513946f6b Mon Sep 17 00:00:00 2001 From: Ethan Zheng <77181471+EthanZheng11@users.noreply.github.com> Date: Sat, 9 Dec 2023 23:22:44 +0000 Subject: [PATCH 3/5] Corrected flake8 linting errors. --- 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 4d6a387e851e..2a4622c5c185 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -738,7 +738,7 @@ def test_tricontour(self): def test_tricontourf(self): mpl.rcParams["date.converter"] = "concise" fig, ax = plt.subplots() - + np.random.seed(11) limit_value = 30 test_date = datetime.datetime(2023, 10, 1) @@ -753,7 +753,7 @@ def test_tricontourf(self): z_data = np.sin(x_dates_converted) + np.cos(y_data) - triangulation = mpl.tri.Triangulation(x_dates_converted, y_data) + triangulation = mpl.tri.Triangulation(x_dates_converted, y_data) ax.tricontourf(triangulation, z_data) From 364163aebc4a3d99995770e02cc865505fe69337 Mon Sep 17 00:00:00 2001 From: Ethan Zheng <77181471+EthanZheng11@users.noreply.github.com> Date: Sat, 9 Dec 2023 23:28:32 +0000 Subject: [PATCH 4/5] Modified seed number. --- lib/matplotlib/tests/test_datetime.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/matplotlib/tests/test_datetime.py b/lib/matplotlib/tests/test_datetime.py index 2a4622c5c185..f705768ac28e 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -739,9 +739,8 @@ def test_tricontourf(self): mpl.rcParams["date.converter"] = "concise" fig, ax = plt.subplots() - np.random.seed(11) + np.random.seed(19680801) limit_value = 30 - test_date = datetime.datetime(2023, 10, 1) x_dates = np.array( [datetime.datetime(2023, 10, n) for n in range(1, limit_value)] From 24666bd1d0c319b45114d7b8e498a0a5b9946387 Mon Sep 17 00:00:00 2001 From: Ethan Zheng <77181471+EthanZheng11@users.noreply.github.com> Date: Sat, 9 Dec 2023 23:37:37 +0000 Subject: [PATCH 5/5] Removed triangulation variable. --- lib/matplotlib/tests/test_datetime.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/matplotlib/tests/test_datetime.py b/lib/matplotlib/tests/test_datetime.py index f705768ac28e..89c8a15b3dcd 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -752,9 +752,7 @@ def test_tricontourf(self): z_data = np.sin(x_dates_converted) + np.cos(y_data) - triangulation = mpl.tri.Triangulation(x_dates_converted, y_data) - - ax.tricontourf(triangulation, z_data) + ax.tricontourf(x_dates_converted, y_data, z_data) @pytest.mark.xfail(reason="Test for tripcolor not written yet") @mpl.style.context("default")
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: