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
<<attachment: 1.png>>
<<attachment: 2.png>>
>From c38cc7146d85a6b43a0ecb6013c10e0789bb3a1f Mon Sep 17 00:00:00 2001 From: Detlef Maurel <[email protected]> Date: Tue, 16 Apr 2013 11:45:38 +0200 Subject: [PATCH] fix y axis range for histogram in step mode --- lib/matplotlib/axes.py | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-) diff --git a/lib/matplotlib/axes.py b/lib/matplotlib/axes.py index 2c06ff8..72b7a50 100644 --- a/lib/matplotlib/axes.py +++ b/lib/matplotlib/axes.py @@ -8456,10 +8456,7 @@ class Axes(martist.Artist): elif orientation == 'vertical': ymin0 = max(_saved_bounds[1]*0.9, minimum) ymax = self.dataLim.intervaly[1] - for m in n: - ymin = np.amin(m[m != 0]) # filter out the 0 height bins - ymin = max(ymin*0.9, minimum) - ymin = min(ymin0, ymin) + ymin = min(ymin0, np.min(n)) self.dataLim.intervaly = (ymin, ymax) if label is None: -- 1.7.4.1
------------------------------------------------------------------------------ Precog is a next-generation analytics platform capable of advanced analytics on semi-structured data. The platform includes APIs for building apps and a phenomenal toolset for data science. Developers can use our toolset for easy data analysis & visualization. Get a free account! http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________ Matplotlib-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-devel