title: cmap for use with line plot
body: <p>I have a list of color values (in either of the formats: hex ('#ffffff') or rgb (255,255,255) if that helps). These colors correspond explicitly with the line segment between points. Currently I plot a line as a collection of line segments via:</p>
  
  <pre><code>import matplotlib.pyplot as plt
  import itertools
  colors = itertools.cycle('#ffffff', '#ffffff', '#ff0320', '#452143', ...)
  t = (0, 1, 2, 3, ...)
  var1 = (43, 15, 25, 9, ...)
  ax = plt.subplot2grid((3,1), (0,0), colspan=3, rowspan=1)
  
  ps = [(t,var1) for (t,var1) in zip(t, val)]
  for start, end in zip(ps[:-1], ps[1:]):
      t, var1 = zip(start, end)
      c = next(colors)    
      ax.plot(t, var1, color=c)
  </code></pre>
  
  <p>However since I have a color for each point I would much prefer to set a cmap for the plot. How might I accomplish converting a list of colors into a cmap which I can use when plotting a line?</p>