Skip to content

Commit 45cf538

Browse files
committed
TST: check bar and barh work with timedelta
1 parent 563c41a commit 45cf538

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

lib/matplotlib/tests/test_axes.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1481,6 +1481,29 @@ 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+
fig, ax = plt.subplots()
1499+
ax.barh([datetime.datetime(2018, 1, 1), datetime.datetime(2018, 1, 1)],
1500+
np.array([1, 1.5]),
1501+
height=datetime.timedelta(hours=3))
1502+
ax.barh([datetime.datetime(2018, 1, 1), datetime.datetime(2018, 1, 1)],
1503+
np.array([1, 1.5]),
1504+
height=[datetime.timedelta(hours=t) for t in [1, 2]])
1505+
1506+
14841507
@image_comparison(baseline_images=['hist_log'],
14851508
remove_text=True)
14861509
def test_hist_log():

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

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:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy