Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Description
Bug summary
Issue Description:
When using ax.barh to visualize intervals, the function fails to display all intervals under certain conditions, which appears to be linked to the width of the intervals specified as duration. Specifically, intervals with a duration of 3 hours are not displayed properly, while increasing the duration to 5 hours results in correct visualization. This issue suggests a potential problem with how interval widths are handled or rendered in ax.barh.
Steps to Reproduce:
Refer to "code for reproduction"
Expected Behavior:
All intervals should be visualized consistently, regardless of their duration width.
Actual Behavior:
Intervals with a shorter duration (3 hours) are not visualized correctly, while longer durations (5 hours) are displayed as expected.
Code for reproduction
fromdatetimeimportdatetime,timedeltaimportmatplotlib.pyplotaspltfig,ax=plt.subplots()duration=timedelta(hours=3)# duration = timedelta(hours=5)ax.barh(y=0,width=duration,left=datetime(2024,1,1,6))ax.barh(y=1,width=duration,left=datetime(2024,1,1,1))plt.xticks(rotation=45)plt.tight_layout()plt.savefig('bug.png')
Actual outcome
Only one of two bars is rendered.
Expected outcome
Additional information
No response
Operating system
Ubuntu and Manjaro
Matplotlib Version
3.8.4
Matplotlib Backend
agg
Python version
3.11.8
Jupyter version
No response
Installation
pip