Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project!

## [Matplotlib-users] hist(normed=1) problem

 [Matplotlib-users] hist(normed=1) problem From: Le Zhang - 2005-09-15 15:57:41 ```Hello, I just tried the matplotlib-0.83.2 and found a problem in hist(normed=3D1). Sometimes the *normalized* y values can be greater than 1.0. I looked into the source code and find the code does not perform the supposed *normalization*. =20 Here's the code that shows the problem on a very unbalanced data: data =3D [3]*1000=20 data.append(4) n, bins, patches =3D hist(data, 30, normed=3D1) print n I got something like: [ 29.97002997, 0. , 0. , 0. , 0. , 0. = , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0.02997003,] the first column has a value much higher than 1.0, it's not a probability distribution I believe. Zhang Le ```

 [Matplotlib-users] hist(normed=1) problem From: Le Zhang - 2005-09-15 15:57:41 ```Hello, I just tried the matplotlib-0.83.2 and found a problem in hist(normed=3D1). Sometimes the *normalized* y values can be greater than 1.0. I looked into the source code and find the code does not perform the supposed *normalization*. =20 Here's the code that shows the problem on a very unbalanced data: data =3D [3]*1000=20 data.append(4) n, bins, patches =3D hist(data, 30, normed=3D1) print n I got something like: [ 29.97002997, 0. , 0. , 0. , 0. , 0. = , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0.02997003,] the first column has a value much higher than 1.0, it's not a probability distribution I believe. Zhang Le ```
 Re: [Matplotlib-users] hist(normed=1) problem From: John Hunter - 2005-09-16 02:11:41 ```>>>>> "Le" == Le Zhang writes: Le> the first column has a value much higher than 1.0, it's not a Le> probability distribution I believe. Ahh, this appears to be a docstring bug. The plotting function matplotlib.axes.Axes.hist docstring indicates "probability distribution" but the underlying function matplotlib.mlab.hist which computes the histogram correctly states that it returns a probability *density*, ie, it integrates to one. Thanks for pointing this out. The docstring will be updated for the next release. Cheers, JDH ```