SourceForge logo
SourceForge logo
Menu

matplotlib-devel

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
From: Pierre H. <pie...@cr...> - 2013年04月16日 13:16:54
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.
best,
Pierre
From: Detlef M. (IKP) <det...@ki...> - 2013年04月16日 13:42:10
Attachments: data.txt
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.
>
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
From: Pierre H. <pie...@cr...> - 2013年04月17日 12:31:57
Attachments: signature.asc
Hi,
Le 16/04/2013 15:41, Detlef Maurel (IKP) a écrit :
> 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") 
Indeed, I could reproduce your problem using your specific dataset.
The automated selection of ylim is not working as expected, and I don't
know why !
best,
Pierre
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /