-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
plt.bar() creates different results when repeated #13909
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
same issue |
It is a rendering issue that you can aminorate by making the figure or the bars wider. There is a limit to what can be done when you have more bars than horizontal pixels and the bars are less than 1 pixel wide. |
But then it would still be better to plot three times the same aliased plot, wouldn't it? |
The problem is that the axes position is in fractional units of the figure. Hence the same plot at different positions inside the figure will have different pixels being ommitted. In general if you have bars of width smaller than a pixel, consider
|
Thanks for the explanation! |
Re-opening. I think there should be the option to properly anti-alias here ala #13724. However, this canvas-level anti-aliasing will have to happen at a lower level... |
There should at least be one of those red warnings when the image is smaller than the resolution needed to plot the bars correclty. |
I guess this is basically the same issue as the one being discussed at #13236 (comment)? |
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help! |
Bug report
Bug summary
When plotting a bar graph of some data from
np.histogram
on several different axis the outcome always slightly differs from each other.Code for reproduction
Actual outcome

Expected outcome
The same barplot three times.
Matplotlib version
print(matplotlib.get_backend())
): module://ipykernel.pylab.backend_inlineMatplotlib installed via standard conda channel.
The text was updated successfully, but these errors were encountered: