From 11fe616d798b9289360280db9e4bfa143159c850 Mon Sep 17 00:00:00 2001 From: rawwash Date: Thu, 30 Nov 2023 10:16:04 -0500 Subject: [PATCH 1/3] add quiver datetime test --- lib/matplotlib/tests/test_datetime.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/tests/test_datetime.py b/lib/matplotlib/tests/test_datetime.py index 316be793e47c..9ebd9456c749 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -446,11 +446,20 @@ def test_plot_date(self): 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") def test_quiver(self): - fig, ax = plt.subplots() - ax.quiver(...) + dates = [datetime.datetime(2023, 1, 1) + + datetime.timedelta(days=i) for i in range(5)] + x = dates + y = np.zeros_like(x, dtype=float) + u = np.sin(np.arange(len(x))) + v = np.cos(np.arange(len(x))) + fig, ax = plt.subplots(figsize=(10, 6)) + ax.quiver(x, y, u, v, scale=20) + fig.autofmt_xdate() + ax.set_title('Quiver Plot with Datetime Data') + ax.set_xlabel('Date') + ax.set_ylabel('Y-axis') @pytest.mark.xfail(reason="Test for quiverkey not written yet") @mpl.style.context("default") @@ -611,3 +620,7 @@ def test_vlines(self): def test_xcorr(self): fig, ax = plt.subplots() ax.xcorr(...) + +if __name__ == "__main__": + test = TestDatetimePlotting() + test.test_quiver() From a2a20571af4f9485f8909fea4ddcb6183538365d Mon Sep 17 00:00:00 2001 From: rawwash Date: Thu, 30 Nov 2023 10:18:48 -0500 Subject: [PATCH 2/3] removed main --- lib/matplotlib/tests/test_datetime.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/matplotlib/tests/test_datetime.py b/lib/matplotlib/tests/test_datetime.py index 9ebd9456c749..4e2321afc1e0 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -620,7 +620,3 @@ def test_vlines(self): def test_xcorr(self): fig, ax = plt.subplots() ax.xcorr(...) - -if __name__ == "__main__": - test = TestDatetimePlotting() - test.test_quiver() From bfee0b37e54ab06c4faba990d0196e0780fe18a4 Mon Sep 17 00:00:00 2001 From: rawwash <112187975+rawwash@users.noreply.github.com> Date: Sat, 2 Dec 2023 10:14:45 -0500 Subject: [PATCH 3/3] Update lib/matplotlib/tests/test_datetime.py Co-authored-by: Elliott Sales de Andrade --- 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 4e2321afc1e0..05069e3bb805 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -448,8 +448,8 @@ def test_plot_date(self): @mpl.style.context("default") def test_quiver(self): - dates = [datetime.datetime(2023, 1, 1) + - datetime.timedelta(days=i) for i in range(5)] + dates = [datetime.datetime(2023, 1, 1) + datetime.timedelta(days=i) + for i in range(5)] x = dates y = np.zeros_like(x, dtype=float) u = np.sin(np.arange(len(x)))