-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Error autoscaling histogram with histtype='step' #841
Comments
I see a (probably) related problem with the % ipython --pylab
In [1]: hist(normal(100, 15, 10000), normed=True, histtype='step')
Out[1]:
(array([ 1.68129565e-05, 1.68129565e-04, 1.41228835e-03,
7.06144175e-03, 1.79730506e-02, 2.50933376e-02,
2.09405374e-02, 9.12943541e-03, 1.96711592e-03,
3.02633218e-04]),
array([ 33.23287027, 45.12845802, 57.02404577, 68.91963352,
80.81522128, 92.71080903, 104.60639678, 116.50198453,
128.39757228, 140.29316004, 152.18874779]),
<a list of 1 Patch objects>) This produces a plot with y-axis from 0 to 40. Without I've seen this with matplotlib 1.1.0 on CentOS-5 x86_64 and matplotlib 1.0.1 on Snow leopard. I think that 1.0.0 was OK (or maybe 0.99.1), since I have old code with |
I guess I found the bug: in matplotlib/axes.py:7729 (for matplotlib 1.1.0), it says:
which is just wrong. Replace this line with something like:
fix the bug. BTW, few lines below, the code:
does not make much sense either, but I have no idea what it is supposed to do anyway... |
Could this be corrected for matplotlib 1.2? |
Fix by Yannick Copin for hist autoscaling bug; closes issue #841
This looks like at has come back (the code from first report is still generates a graph with strange limits). @neggert Can you take a look at this? |
Sure. There's another bug a colleague pointed out to me that I've been wanting to look at, so I can work on these both tomorrow. |
@tacaswell I can't seem to reproduce this on either v1.3.x or master. I get a plot with a y-axis that goes from 0 to 1 (which isn't great either because you can't see the line, but it's not the same issue). |
Yeah, I didn't read carefully enough (parsed 'bad limits', not what sort of bad limits). This looks like it is actually an issue with the generic auto-limit code. Sorry for the noise. |
Seems like the original issue has been fixed along the way. Closing. |
I am running into problems where histograms are not autoscaling correctly.
Below is a very simple example which reproduces this problem:
When I run this example using matplotlib v1.1.0 or using the absolute latest version of matplotlib, I obtain an axes which varies from 3000<x<3012 and 0<y<3000 with no visible histogram.
When I add (before saving the plot) the line:
I get a reasonable axes range and can see the histogram.
I also get a reasonable axes range when I remove the command histtype='step' or when I use matplotlib v1.0.0.
Thanks for your help,
Joshua
The text was updated successfully, but these errors were encountered: