Hi all,
there seems to be a bug in in pyplot.hist when using histtype="step".
I am plotting the attached data to a histogram (see 1.png). In this case I set the limits on the y axis manually.
When I don't do this (let the hist function choose the limits), I get the picture in the file 2.png. Only the highest bin is drawn. To be exact, ymin=second highest value, ymax=highest value.
To solve this, I suggest the patch in the attachment.
I also removed the for loop here, because I don't see why 0 height bins should be filtered out (but this is just a suggestion).
cheers,
Detlef Maurel


0001-fix-y-axis-range-for-histogram-in-step-mode.patch (998 Bytes)
this works for me, too. Strange... I get the problem with the attached dataset using the command
hist(loadtxt("data.txt"),bins=300,histtype="step")
When I plot only a subset of the data (first/second/third/... thousand numbers),
the histogram looks fine. It seems it gets wrong when more than roughly 2000 numbers are used.
I will try to dig more into this and let you know if I find something.
cheers
Detlef
data.txt (199 KB)
···
On 16.04.2013 14:58, Pierre Haessig wrote:
Hi,
Le 16/04/2013 12:14, Detlef Maurel (IKP) a �crit :
there seems to be a bug in in pyplot.hist when using histtype="step".
I am plotting the attached data to a histogram (see 1.png). In this
case I set the limits on the y axis manually.
When I don't do this (let the hist function choose the limits), I get
the picture in the file 2.png. Only the highest bin is drawn. To be
exact, ymin=second highest value, ymax=highest value.
Can you also send a minimal code that reproduces the bug. I just tried a
hist(x, histtype='step') command, with x being a random vector and it
works fine.