Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a37c072

Browse files
committed
TST: check bar and barh work with timedelta
1 parent 93d346c commit a37c072

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

lib/matplotlib/tests/test_axes.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1481,6 +1481,21 @@ def test_barh_tick_label():
14811481
align='center')
14821482

14831483

1484+
def test_bar_timedelta():
1485+
"""smoketest that bar can handle width and height in delta units"""
1486+
fig, ax = plt.subplots()
1487+
ax.bar(datetime.datetime(2018, 1, 1), 1.,
1488+
width=datetime.timedelta(hours=3))
1489+
ax.bar(datetime.datetime(2018, 1, 1), 1.,
1490+
xerr=datetime.timedelta(hours=2),
1491+
width=datetime.timedelta(hours=3))
1492+
fig, ax = plt.subplots()
1493+
ax.barh(datetime.datetime(2018, 1, 1), 1,
1494+
height=datetime.timedelta(hours=3))
1495+
ax.barh(datetime.datetime(2018, 1, 1), 1,
1496+
height=datetime.timedelta(hours=3),
1497+
yerr=datetime.timedelta(hours=2))
1498+
14841499
@image_comparison(baseline_images=['hist_log'],
14851500
remove_text=True)
14861501
def test_hist_log():

0 commit comments

Comments
 (0)