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
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.
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
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
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
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
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