new_contents: import numpy as np
  import pylab as p
  
  __all__ = ['circles', 'mid', 'compare']
  
  def mid(x):
    x = np.asarray(x)
  = lambda x:(x[1:] + x[:-1])/2.
  
  def circles(x, y, s, c='b', ax=None, vmin=None, vmax=None, **kwargs):
      """
      Make a scatter of circles plot of x vs y, where x and y are sequence 
        like objects of the same lengths. The size of circles are in data scale.
  
      Parameters
      ----------
      x,y : scalar or array_like, shape (n, )
          Input data
      s : scalar or array_like, shape (n, ) 
          Radius of circle in data scale (ie. in data unit)
      c : color or sequence of color, optional, default : 'b'
          `c` can be a single color format string, or a sequence of color
          specifications of length `N`, or a sequence of `N` numbers to be
          mapped to colors using the `cmap` and `norm` specified via kwargs.
          Note that `c` should not be a single numeric RGB or
          RGBA sequence because that is indistinguishable from an array of
          values to be colormapped.  `c` can be a 2-D array in which the
          rows are RGB or RGBA, however.
      ax : Axes object, optional, default: None
          Parent axes of the plot. It uses gca() if not specified.
      vmin, vmax : scalar, optional, default: None
          `vmin` and `vmax` are used in conjunction with `norm` to normalize
          luminance data.  If either are `None`, the min and max of the
          color array is used.  (Note if you pass a `norm` instance, your
          settings for `vmin` and `vmax` will be ignored.)
  
      Returns
      -------
      paths : `~matplotlib.collections.PathCollection`
  
      Other parameters
      ----------------
      kwargs : `~matplotlib.collections.Collection` properties
          eg. alpha, edgecolors, facecolors, linewidths, linestyles, norm, cmap
  
      Examples
      --------
      a = np.arange(11)
      circles(a, a, a*0.2, c=a, alpha=0.5, edgecolor='none')
  
      License
      --------
      This code is under [The BSD 3-Clause License]
      (http://opensource.org/licenses/BSD-3-Clause)
      """
      from matplotlib.pyplot import gca
      from matplotlib.patches import Circle
      from matplotlib.collections import PatchCollection
  
      if ax is None:
          ax = gca()
  
      if isinstance(c,basestring):
          color = c     # ie. use colors.colorConverter.to_rgba_array(c)
      else:
          color = None  # use cmap, norm after collection is created
      kwargs.update(color=color)
  
      if np.isscalar(x):
          patches = [Circle((x, y), s),]
      elif np.isscalar(s):
          patches = [Circle((x_,y_), s) for x_,y_ in zip(x,y)]
      else:
          patches = [Circle((x_,y_), s_) for x_,y_,s_ in zip(x,y,s)]
      collection = PatchCollection(patches, **kwargs)
  
      if color is None:
          collection.set_array(np.asarray(c))
          if vmin is not None or vmax is not None:
              collection.set_clim(vmin, vmax)
  
      ax.add_collection(collection)
      ax.autoscale_view()
      
      return collection
      
  
subject: Create plot.py