On Mar 18, 2007, at 12:41 PM, John Hunter wrote:

> On 3/17/07, Simson Garfinkel <[EMAIL PROTECTED]> wrote:
>> Hi. I haven't been active for a while, but now I have another paper
>> that I need to get out...
>
> Glad to have you back...

Thanks.  I've taken a new job, moved to california, and have been  
flying between the two coasts every week. It doesn't leave much time  
for mailing lists...

>
>> Anyway, I need to draw a cumulative distribution function, as the
>> reviewers of my last paper really nailed me to the wall for including
>> histograms instead of CDFs. Is there any way to plot a CDF with
>> matplotlib?
>
> For analytic cdfs, see scipy.stats.  I assume you need an empirical
> cdf.  You can use matplotlib.mlab.hist to compute the empirical pdf
> (use normed=True to return a PDF rather than a frequency count).  Then
> use numpy.cumsum to do the cumulative sum of the pdf, multiplying by
> the binsize so it approximates the integral.
>
> import matplotlib.mlab
> from pylab import figure, show, nx
>
> x = nx.mlab.randn(10000)
> p,bins = matplotlib.mlab.hist(x, 50, normed=True)
> db = bins[1]-bins[0]
> cdf = nx.cumsum(p*db)
>
> fig = figure()
> ax = fig.add_subplot(111)
> ax.bar(bins, cdf, width=0.8*db)
> show()
>

Thanks! I'll try it out and see what happens.


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to