On Mon, Dec 14, 2009 at 10:22 AM, Susanne Pfeifer <ti...@tiffy.it> 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).

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

------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to