title: Scatter plot colors corresponding to a value
body: <p>In all the colormap posts I have not found this answer, or maybe did not understand it.</p>
  
  <p>I want to make a scatter plot with colors. </p>
  
  <p>I have a list B:</p>
  
  <pre><code>[1.29,
   1.27,
   1.46,
   0.91,
   0.56,
   0.99,
   1.00,
   0.37,
   1.24,
   1.23]
  </code></pre>
  
  <p>I will just use a stupid example, if you do:</p>
  
  <pre><code>import matplotlib.pyplot as plt
  from matplotlib import cm
  from math import sin
  
  x=range(10)
  y=[sin(i) for i in x]
  colors=np.linspace(0,1,10)
  
  plt.scatter(x,y,c=colors,cmap=cm.jet)
  </code></pre>
  
  <p>You get points with different colors, nice.
  <img src="https://i.stack.imgur.com/GGnfK.png" alt="enter image description here"></p>
  
  <p>BUT ! I do not want to only get nicely colored points ! I want the points to be colored according to the "intensity" of the values in B.</p>
  
  <p>Here is my stupid attempt:</p>
  
  <pre><code>import matplotlib.pyplot as plt
  from matplotlib import cm
  from math import sin
  
  x=range(10)
  y=[sin(i) for i in x]
  #colors=np.linspace(0,1,10)
  B=[1.29,1.27,1.46,0.91,0.56,0.99,1.00,0.37,1.24,1.23]
  
  plt.scatter(x,y,c=B,cmap=cm.jet)
  </code></pre>
  
  <p>You get points colored according to the intensity of the values in B, very nice:
  <img src="https://i.stack.imgur.com/aZH2Y.png" alt="enter image description here"></p>
  
  <p>BUT !! I would like to change the "scale" of colors to have deep blue at 0 and deep red at 2. In which case the third point (associated with <code>B[2]=1.46</code>) should be orange and not deep red ! How should I do this? </p>