On Friday July 9 2010 06:02:58 per freem wrote:
> How can I plot the empirical CDF of an array of numbers in matplotlib
> in Python? I'm looking for the cdf analog of pylab's "hist" function.
> 
> One thing I can think of is:
> 
> from scipy.stats import cumfreq
> a = array([...]) # my array of numbers
> num_bins =  20
> b = cumfreq(a, num_bins)
> plt.plot(b)
> 
> Is that correct though? Is there an easier/better way?

Hi,

I would use pyplot.hist to produce a histogram with a bar for each bin. By use 
of the keyword argument 'cumulative' you can select cumulative frequency 
distribution instead of density.

Kind regards,
Matthias

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to