Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

[Bug]: Inconsistent Visualization of Intervals in ax.barh for Different Duration Widths #28223

Closed
@AndreasLR

Description

@AndreasLR

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.
image

Expected outcome

I expect both bars to appear:
image

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp