title: How to plot cdf in matplotlib in Python?
body: <p>I have a disordered list named <code>d</code> that looks like:</p>
  
  <pre><code>[0.0000, 123.9877,0.0000,9870.9876, ...]
  </code></pre>
  
  <p>I just simply want to plot a cdf graph based on this list by using Matplotlib in Python. But don't know if there's any function I can use</p>
  
  <pre><code>d = []
  d_sorted = []
  for line in fd.readlines():
      (addr, videoid, userag, usertp, timeinterval) = line.split()
      d.append(float(timeinterval))
  
  d_sorted = sorted(d)
  
  class discrete_cdf:
      def __init__(data):
          self._data = data # must be sorted
          self._data_len = float(len(data))
  
      def __call__(point):
          return (len(self._data[:bisect_left(self._data, point)]) / 
                 self._data_len)
  
  cdf = discrete_cdf(d_sorted)
  xvalues = range(0, max(d_sorted))
  yvalues = [cdf(point) for point in xvalues]
  plt.plot(xvalues, yvalues)
  </code></pre>
  
  <p>Now I am using this code, but the error message is :</p>
  
  <pre><code>Traceback (most recent call last):
  File "hitratioparea_0117.py", line 43, in &lt;module&gt;
  cdf = discrete_cdf(d_sorted)
  TypeError: __init__() takes exactly 1 argument (2 given)
  </code></pre>