Am Thu, 29 May 2014 14:14:52 -0700
schrieb Antony Lee <antony....@berkeley.edu>:

> Hi,
> When histogramming integer data, is there an easy way to tell
> matplotlib that I want a certain number of bins, and each bin to
> cover an equal number of integers (except possibly the last one)?
> (in order to avoid having some bins higher than others merely because
> they cover more integers) I know I can pass in an explicit bins array
> (something like list(range(min, max, (max-min)//n)) + max) but I was
> hoping for something simpler, like hist(data, nbins=42,
> equal_integer_coverage=True). Best,
> Antony

Int data is discrete. For discrete variables you don't need bins, you
don't estimate the frequency distribution you know it exactly by
counting.

Of course you could do that with the hist function:

>>> pl.hist(r, np.arange(min(r)-0.5, max(r)+1.5), histtype='step')

------------------------------------------------------------------------------
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to