title: getting color from 0-1 range in matplotlib
body: <p>I have a number of scatterplots for which i would the color of the plot to represent correlation between the variables. Correlation is normalized to [0,1] and I would like something like blue for 0 to red for 1, but I'm ok with other combinations.</p>
  
  <p>What is the code to convert my correlation figure to something matplotlib puts on a color spectrum?</p>
  
  <pre><code>for col_s in s_data.columns[1:3]:
      for col_e in economic_data.columns[1:3]:
          x= s_data[col_s].interpolate(method='nearest').tolist()
          y= economic_data[col_e].interpolate(method='nearest').tolist()
  
          corr=np.corrcoef(x,y)[0,1]
          plt.scatter(x, y, alpha=0.5, c=to_rgb(corr))
          plt.show()
  </code></pre>