Matplotlib CDF plot
cdf_plot.py Download this file
I was searching for a matlab cdfplot in pylab but couldn't something which is as simple as the one matlab has. So I ported the one matlab has to numpy and pylib, and it turned out quite nice.
Attached is the code for the cdf_plot. It's very easy to use, simply create a numpy array and cdf_plot it. Also, it has a __main__ so you can run it and see it works.
For example, the following plots a simple CDF plot of an array:
python
$ import numpy
$ import cdf_plot
$ x=numpy.array([1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 6, 7, 8, 9])
$ cdf_plot.cdf_plot( x )
A cool feature that does not exist in matlab, is the ability to add markers in specific values. This is simply by adding a "values" key in the parameters list:
$ cdf_plot.cdf_plot( x, values="2:rx,4:bo" )
This adds a red x marker on x=2 and a blue o marker on x=4.












