Re: [Matplotlib-users] how to plot the empirical cdf of an array?

2010-07-09 Thread Matthias Michler
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

Re: [Matplotlib-users] how to plot the empirical cdf of an array?

2010-07-09 Thread Alan G Isaac
On 7/9/2010 12:02 AM, per freem wrote: How can I plot the empirical CDF of an array of numbers in matplotlib in Python? I recalled David Huard posted the below, which apparently was once in the sandbox... hth, Alan Isaac def empiricalcdf(data, method='Hazen'): Return the empirical cdf.

Re: [Matplotlib-users] how to plot the empirical cdf of an array?

2010-07-09 Thread per freem
I'd like to clarify: I want the empirical cdf, but I want it to be normalized. There's a normed=True option to plt.hist but how can I do the equivalent for CDFs? On Fri, Jul 9, 2010 at 9:14 AM, Alan G Isaac alan.is...@gmail.com wrote: On 7/9/2010 12:02 AM, per freem wrote:  How can I plot the

Re: [Matplotlib-users] how to plot the empirical cdf of an array?

2010-07-09 Thread Robert Kern
On 7/9/10 10:02 AM, per freem wrote: I'd like to clarify: I want the empirical cdf, but I want it to be normalized. There's a normed=True option to plt.hist but how can I do the equivalent for CDFs? There is no such thing as a normalized empirical CDF. Or rather, there is no such thing as an

Re: [Matplotlib-users] how to plot the empirical cdf of an array?

2010-07-09 Thread per freem
How does Alan's code compare with using cumfreq and then plotting its result? Is the only difference that cumfreq bins the data? On Fri, Jul 9, 2010 at 10:12 AM, Robert Kern robert.k...@gmail.com wrote: On 7/9/10 10:02 AM, per freem wrote: I'd like to clarify: I want the empirical cdf, but I

Re: [Matplotlib-users] how to plot the empirical cdf of an array?

2010-07-09 Thread per freem
Also, I am not sure how to use alan's code. If I try: ec = empirical_cdf(my_data) plt.plot(ec) it doesn't actually look like a cdf On Fri, Jul 9, 2010 at 10:17 AM, per freem perfr...@gmail.com wrote: How does Alan's code compare with using cumfreq and then plotting its result?  Is the only

Re: [Matplotlib-users] how to plot the empirical cdf of an array?

2010-07-09 Thread Robert Kern
On 7/9/10 10:31 AM, per freem wrote: Also, I am not sure how to use alan's code. If I try: ec = empirical_cdf(my_data) plt.plot(ec) it doesn't actually look like a cdf Make sure my_data is sorted first. plt.plot(my_data, ec) You probably want to use one of the steps linestyles; I'm not