Thanks for the information. Unfortunately, this CDF doesn't look like  
the CDF that we see in other published papers. I'm not sure what they  
are done with...  But they have a thin line that shows the integral  
of all measurements, rather than a bar graph. The problem with a bar  
graph is that different bin widths give different results.

GNU Plot seems to do a decent job, as can e seen at http:// 
chem.skku.ac.kr/~wkpark/tutor/gnuplot/gpdocs/prob.htm. But there  
should be a way to do this nicely with matplotlib, right?


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


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