title: Elegant way to match a string to a random color matplotlib
body: <p>I want to translate the labels of some data to colors for graphing with matplotlib</p>
  
  <p>I have a list of names <code>["bob", "joe", "andrew", "pete"]</code></p>
  
  <p>Is there a built in way to map these strings with color values in matplotlib? I thought about randomly creating hex values but I could end up with similar colors or non visible colors.</p>
  
  <p>I've tried a couple different ways of trying to create key values from the below cmap answer:</p>
  
  <p>this:</p>
  
  <pre><code>#names is a list of distinct names
  cmap = plt.get_cmap('cool')
  colors = cmap(np.linspace(0, 1, len(names)))
  clr = {names[i]: colors[i] for i in range(len(names))}
  ax.scatter(x, y, z, c=clr)
  </code></pre>