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

Skip to content

[Bug]: bar() displays gaps when plotting too many values #27816

Closed
@ivanightingale

Description

@ivanightingale

Bug summary

When plotting around 1300-1400 values with matplotlib.pyplot.bar(), empty gaps appear in the resulting bar plot. When saving the figure, the gaps shift to a different location. If a long enough title is added to the plot, the gaps also shift.

Code for reproduction

a = np.random.rand(1355)  # one of the most apparent examples
plt.bar(range(len(a)), a)
# plt.title("TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT")  # this will result in different gaps

Actual outcome

image
image

Expected outcome

Bar charts should be plotted correctly. Adding a title or saving the figure should not alter the chart.

Additional information

No response

Operating system

RHEL

Matplotlib Version

3.7.1

Matplotlib Backend

module://matplotlib_inline.backend_inline

Python version

3.10.11

Jupyter version

6.5.4

Installation

conda

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions