title: Picking plot colors from matplotlib colorbar?
body: <p>I have a loop that plots data (onto the same plot) every iteration. I'm trying to figure out how to set it so that the color of each data set is drawn from a colorbar depending on the iteration number -- that is, so each iteration of the loop plots a line that is a darker shade of blue (for instance) than the line before it. </p>
  
  <p>My code looks something like this:</p>
  
  <pre><code>for k in numpy.arange(0, iterations, 500):
      h,binEdges=numpy.histogram(data1[k])
      bincenters = 0.5*(binEdges[1:]+binEdges[:-1])
      plt.plot(bincenters,h,label=(str(k)))
  plt.title(title)
  plt.legend(fontsize=6)
  plt.show()
  </code></pre>
  
  <p>(data1 is a dictionary.) Does anyone know how this might be done?</p>