title: Matplotlib adding legend based on existing color series
body: <p>I plotted some data using scatter plot and specified it as such:</p>
  <pre><code>plt.scatter(rna.data['x'], rna.data['y'], s=size,
                      c=rna.data['colors'], edgecolors='none')
  </code></pre>
  <p>and the rna.data object is a pandas dataframe that is organized such that each row represents a data point ('x' and 'y' represents the coordinate and 'colors' is an integer between 0-5 representing the color of the point). I grouped the data points into six distinct clusters numbered 0-5, and put the cluster number at each cluster's mean coordinates.</p>
  <p>This outputs the following graph:
  <a href="https://i.stack.imgur.com/U0LzJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/U0LzJ.png" alt="graph output" /></a></p>
  <p>I was wondering how I can add a legend to this plot specifying the color and its corresponding cluster number. <code>plt.legend()</code> requires the style code to be in the format such as <code>red_patch</code> but it does not seem to take numeric values (or the numeric strings). How can I add this legend using matplotlib then? Is there a way to translate my numeric value color codes to the format that <code>plt.legend()</code> takes? Thanks a lot!</p>