[Numpy-discussion] Bugs in histogram and matplotlib-hist

Mike Ressler mike.ressler@alum.mit....
Tue Nov 11 17:19:42 CST 2008

I did an update to a Fedora 9 workstation yesterday that included
updating numpy to 1.2.0 and matplotlib 0.98.3 (python version is
2.5.1). This seems to have played havoc with some of the histogram
plotting we do. I was aware of the histogram changes in 1.2.0, but
something doesn't seem to have worked out right.

First issue is that the histogram function doesn't like giving
"normed" any sort of a value. We get a "'NoneType' object is not
iterable" error whenever we tried. I could work around this by editing
function_base.py and given the normed keyword in the histogram
function a default value of False, then changing the last few lines of
histogram to read

        if not normed:
            return n, bins
        else :
            db = array(np.diff(bins), float)
            return n/(n*db).sum(), bins

(i.e. using normed as a true boolean, rather than a testable
variable). That seems to have fixed up that particular issue.

I know this isn't quite the right place to report matplotlib errors,
but the hist function expects the output of the histogram function,
the left edges of the bins, and the frequency values, to be the same
length. Histogram now returns all edges (e.g. 100), while the
frequencies correspond to the number of bins (e.g. 99).

Are these known issues? I didn't see anything in the numpy-1.2.1
release notes to indicate that this was addressed. I guess I should
ask whether other people have even seen this?

I can submit patches after I think a bit harder about proper fixes,
but I'm not a programmer and anything I write should be considered
highly suspect. Please advise. Thanks.



More information about the Numpy-discussion mailing list