title: Python: Invalid RGBA argument 0.0 color points according to class
body: <p><strong>Context</strong></p>
  
  <p>I have some points</p>
  
  <pre><code> points = np.random.uniform(0,10, size = (10,2))
  # array([[ 7.35906037,  6.50049804],
         [ 3.21883403,  3.81452312],
         [ 3.52107154,  1.68233797],
         [ 1.47699577,  6.01692348],
         [ 3.76051589,  0.25213394],
         [ 8.93701081,  5.20377479],
         [ 6.5347188 ,  2.12940006],
         [ 3.62550069,  5.80619507],
         [ 1.33393325,  5.0088937 ],
         [ 6.99034593,  7.40277623]])
  </code></pre>
  
  <p>and they are "classified" or labelled. This means that I have a list</p>
  
  <pre><code>    labels = np.random.randint(0,3, size = 10)
    # array([2, 0, 1, 2, 2, 1, 1, 0, 1, 2])
  </code></pre>
  
  <p>which represents the labels (in order) of each point in <code>points</code>. </p>
  
  <p>I also have some extra points</p>
  
  <pre><code>    extraPoints = np.random.uniform(0,10, size = (3,2))
  # array([[ 1.91211141,  3.71208978],
  #   [ 8.10463536,  1.88948511],
  #   [ 9.79796593,  3.39432552]])
  </code></pre>
  
  <p>basically each of these points determines the class label. It doesn't matter HOW it determined the label. But all you have to know is that each of these extra points is associated to one and only one label. So there is an equal number of extraPoints and label possibilities.</p>
  
  <p><strong>problem</strong></p>
  
  <p>I want to do a scatter plot. I want to assign a different color to each point in <code>extraPoints</code>, and hence this color will be the correspective to each class. This basically means that <code>extraPoints[0]</code> is associated with class <code>0</code>, <code>extraPoints[1]</code> is associated with class <code>1</code> and <code>extraPoints[2]</code> is associated with class <code>2</code>.</p>
  
  <p>Also, I want to scatter plot the points in <code>points</code>. Remember that each point in <code>points</code> is associated with the correspective label in <code>labels</code>.
  For instance <code>[ 7.35906037,  6.50049804]</code> is in class <code>2</code> and thus has the same color of <code>extraPoints[2] = [ 9.79796593,  3.39432552]</code>. Similarly the point <code>[ 3.21883403,  3.81452312]</code> in <code>points</code> is associated with class <code>0</code> in <code>labels</code> and thus has the same color of <code>extraPoints[0] = [ 1.91211141,  3.71208978]</code></p>
  
  <p><strong>My try</strong></p>
  
  <p>I tried using the <code>c</code> argument in <code>plt.scatter()</code> however I don't really understand how it works, and sometimes it sort of works, sometimes it says "Invalid RGBA argument 0.0" but seems to be arbitrary..</p>
  
  <p>Notice that to distinguish <code>points</code> from <code>extraPoints</code>, I will make <code>extraPoints</code> larger and with more transparency.</p>
  
  <pre><code>import matplotlib.pyplot as plt
  # I scatter the points, and assign c to labels. So hopefully each
  # point that ends up in the same label will have the same 
  # color? I  think this part is fine, although I am not sure
  plt.scatter(points[:,0], points[:,1], c = labels) 
  plt.scatter(extraPoints[:,0], extraPoints[:,1], s = 100, alpha = 0.3, c = np.arange(len(extraPoints)))
  </code></pre>
  
  <p>As you can try out for yourself, for different executions (since every time we have random arrays) we might either get it right (or almost) or get the error in the title. Why does this happen? </p>
  
  <p><strong>Extra -for the braves</strong></p>
  
  <p>Given this context, imagine I had also some values</p>
  
  <pre><code>    values = np.random.uniform(0,50, size = 3)
  # array([ 14.63459424,  37.41573654,  34.45202082])
  </code></pre>
  
  <p>I have the same number of values as I have types of labels and extraPoints (i.e. 3 in this case).  Now each of these is associated with the corresponding extraPoints. Thus the first value to the first extraPoint and so on.. </p>
  
  <p>I would like to do the above plot, but the colors will have a "gradient" that becomes, for instance, lighter for smaller values and darker for larger values (or the opposite). How can I do that? I read about colormaps, but I can't quite integrate it with my problem.</p>
  
  <p><strong>Example</strong></p>
  
  <p>For instance for the values above, we obtain:
  <a href="https://i.stack.imgur.com/UVwnG.png" rel="noreferrer"><img src="https://i.stack.imgur.com/UVwnG.png" alt="scatter"></a></p>
  
  <p>As you can see, I have no control over the colors. Not only that, but I have no idea of which point is in which class (unless I go back and manually look at each point, but obviously I don't want this). This is why (and other reasons that I wont cover here) I want to color them based on a value in <code>values</code>. Specifically, I would like, say to have a range of values <code>[10, 20 30]</code> that can guide the color of my points, so that I know which class is "strongest"</p>