[matplotlib-devel] Bug in pyplot.hist when using histtype="step"
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 c38cc7146d85a6b43a0ecb6013c10e0789bb3a1f Mon Sep 17 00:00:00 2001 From: Detlef Maurel 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 Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Bug in pyplot.hist when using histtype="step"
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 -- 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 Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Planning for 1.3.0
Hi Michiel, On 16.04.2013, at 12:03AM, Michiel de Hoon wrote: > Can you perhaps ask the Fink developers to provide a framework installation > of Python? Most matplotlib users who ran into framework-related bugs were > Fink users. I've already looked for that in the list archives and it seems this topic comes up about once a year when some other package broke with the non-framework build. Changing the build does not seem a particular problem, but was always declined as it would mean all (or a large number) of the other Python-dependent packages would have to be fixed at the same time. But I can of course bring this up for discussion again pointing out that the macosx backend support is going to be discontinued. Cheers, Derek -- 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 Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel