title: Getting individual colors from a color map in matplotlib
body: <p>If you have a <a href="https://matplotlib.org/stable/tutorials/colors/colormaps.html" rel="noreferrer">Colormap</a> <code>cmap</code>, for example:</p>
  <pre><code>cmap = matplotlib.cm.get_cmap('Spectral')
  </code></pre>
  <p>How can you get a particular colour out of it between 0 and 1, where 0 is the first colour in the map and 1 is the last colour in the map?</p>
  <p>Ideally, I would be able to get the middle colour in the map by doing:</p>
  <pre><code>&gt;&gt;&gt; do_some_magic(cmap, 0.5) # Return an RGBA tuple
  (0.1, 0.2, 0.3, 1.0)
  </code></pre>