From 5cc46682dfe3de1007ad91f8653261147f025e92 Mon Sep 17 00:00:00 2001 From: ayush Date: Mon, 9 Oct 2023 19:51:38 +0530 Subject: [PATCH] boxplot code updated!! --- lib/matplotlib/tests/test_datetime.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/tests/test_datetime.py b/lib/matplotlib/tests/test_datetime.py index 53958229f174..c3c220f3c863 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -89,8 +89,17 @@ def test_barh(self): @pytest.mark.xfail(reason="Test for boxplot not written yet") @mpl.style.context("default") def test_boxplot(self): - fig, ax = plt.subplots() - ax.boxplot(...) + data = [datetime.datetime(2023, 10, 5, 18, 52, 59), + datetime.datetime(2023, 10, 4, 18, 53, 0), + datetime.datetime(2023, 10, 3, 18, 53, 1), + datetime.datetime(2023, 10, 2, 18, 53, 2), + datetime.datetime(2023, 10, 1, 18, 53, 3)] + datums = np.array([datetime.datetime.toordinal(d) for d in data]) + plt.boxplot(datums, labels=['my data'], showfliers=True) + plt.xlabel('Datetime') + plt.ylabel('value') + plt.title('Boxplot of datetime data') + plt.show() @pytest.mark.xfail(reason="Test for broken_barh not written yet") @mpl.style.context("default")