Hello,
I am relatively new to matplotlib and I was wondering whether there is
an easy possibility to generate a histogram whose height is normalized
to one (rather than the total area under the curve which is the case if
I use normed=1).
Thank you for your help,
Tiffy
Use np.histogram to generate the counts, divide these by the sum of
the counts, and use pyplot.bar to plot the bar heights. Something
like
In [44]: x = np.random.randn(10000)
In [45]: n, bins = np.histogram(x, bins=20)
In [46]: left = bins[:-1]
In [47]: width = bins[1] - bins[0]
In [48]: pct = n/float(n.sum())
In [49]: plt.bar(left, pct, width=width)
JDH
ยทยทยท
On Mon, Dec 14, 2009 at 10:22 AM, Susanne Pfeifer <tiffy@...2899...> wrote:
Hello,
I am relatively new to matplotlib and I was wondering whether there is
an easy possibility to generate a histogram whose height is normalized
to one (rather than the total area under the curve which is the case if
I use normed=1).