Re: [Matplotlib-users] cumulative distribution function
Hi Simson, On Wednesday 21 March 2007 02:59, Simson Garfinkel wrote: 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? Try this one: x = sin(arange(0,100,0.1)) ## your function ## plot the sorted value of your function against ## a linear vektor from 0 to 1 with the same length plot(sort(x), arange(len(x))/float(len(x))) Regrads Werner - 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.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] cumulative distribution function
On 3/20/07, Simson Garfinkel [EMAIL PROTECTED] wrote: 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? Just replace ax.bar(bins, p) with ax.plot(bins, b) in the example code I posted previously... JDH - 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.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] cumulative distribution function
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(1) 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.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] cumulative distribution function
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(1) 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.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] cumulative distribution function
Hi. I haven't been active for a while, but now I have another paper that I need to get out... 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? - 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.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users