Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8be243c

Browse filesBrowse files
authored
Add test_bxp in test_datetime.py (#27390)
* added test case for test_bxp * adding datetime functionality * removing plt.show()
1 parent 2ccc703 commit 8be243c
Copy full SHA for 8be243c

File tree

Expand file treeCollapse file tree

1 file changed

+15
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+15
-2
lines changed

‎lib/matplotlib/tests/test_datetime.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_datetime.py
+15-2Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,24 @@ def test_broken_barh(self):
237237
(datetime.datetime(2023, 1, 4), datetime.timedelta(days=4))],
238238
(20, 9), facecolors=('tab:red'))
239239

240-
@pytest.mark.xfail(reason="Test for bxp not written yet")
241240
@mpl.style.context("default")
242241
def test_bxp(self):
242+
mpl.rcParams["date.converter"] = 'concise'
243243
fig, ax = plt.subplots()
244-
ax.bxp(...)
244+
data = [{
245+
"med": datetime.datetime(2020, 1, 15),
246+
"q1": datetime.datetime(2020, 1, 10),
247+
"q3": datetime.datetime(2020, 1, 20),
248+
"whislo": datetime.datetime(2020, 1, 5),
249+
"whishi": datetime.datetime(2020, 1, 25),
250+
"fliers": [
251+
datetime.datetime(2020, 1, 3),
252+
datetime.datetime(2020, 1, 27)
253+
]
254+
}]
255+
ax.bxp(data, vert=False)
256+
ax.xaxis.set_major_formatter(mpl.dates.DateFormatter("%Y-%m-%d"))
257+
ax.set_title('Box plot with datetime data')
245258

246259
@pytest.mark.xfail(reason="Test for clabel not written yet")
247260
@mpl.style.context("default")

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.