Skip to content
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

Missing final edge in a 'step' histogram for matplotlib 1.3.0 #2365

Closed
nicolaschotard opened this issue Sep 3, 2013 · 4 comments
Closed

Comments

@nicolaschotard
Copy link

Hello,

I recently installed matplotlib 1.3.0, and it seems that pylab.hist() doesn't work as expected when using histtype='step'. The line closing the histogram on its right side is not drawn, leaving the histogram open. This was not the case for matplotlib 1.2, and seems to be present on different system.

The attached plot shows the result obtained using the following lines of code:

import pylab
pylab.hist(pylab.rand(50), histtype='step')
pylab.show()

This problem does not appear when I'm plotting a 'stepfilled' or 'bar' histogram.

Thank you for any feedback,

Nicolas Chotard

hist_bug

@nicolaschotard
Copy link
Author

Hello again,

I was looking at the /matplotlib/axes.py (still version 1.3.0 of matplotlib) code and it seems that the problem could come from the following part of the code, in the hist() function (line 8482):

if fill:
.....
else:
split = int(len(x) / 2) + 1 # here
patches.append(self.fill(
x[:split], y[:split], # and here
closed=False, edgecolor=c,
fill=False))

'x[:split]' should includes the index 'split', but doesn't. Adding 1 to 'split' could resolve this issue.

Please let me know if I missed something here.

Regards,

Nicolas

@mdboom
Copy link
Member

mdboom commented Sep 3, 2013

@neggert: Any thoughts, as I think you were the last to work on this?

@nicolaschotard
Copy link
Author

Thanks for the fix. It's working well this way.

@tacaswell
Copy link
Member

Closing as was fixed is #2372

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants