title: Do matplotlib.contourf levels depend on the amount of colors in the colormap?
body: <p>I'm plotting maps using contourf and I'd usually go with the default (rainbow) colorscheme with levels = 50. </p>
  
  <pre><code>#Various imports
  #LOTS OF OTHER CODE BEFORE
  plot = plt.contourf(to_plot, 50)
  plt.show()
  #LOTS OF OTHER CODE AFTER
  </code></pre>
  
  <p>The output is below. I do various other stuff to get the coastlines etc. It's done using iris and cartopy, if anyone's interested.</p>
  
  <p><img src="https://i.stack.imgur.com/QZ7RO.png" alt="This is the result"></p>
  
  <p>Now I've decided that I don't want to use a rainbow scheme so I'm using some Cyntia Brewer colours:</p>
  
  <pre><code>brewer_cmap = mpl.cm.get_cmap('brewer_Reds_09')
  plot = iplt.contourf(to_plot, 50, cmap=brewer_cmap) # expect 50 levels
  </code></pre>
  
  <p>However the output is:
  <img src="https://i.stack.imgur.com/GdjJG.png" alt="This is the result"></p>
  
  <p>You can see <a href="http://scitools.org.uk/iris/docs/latest/_images/brewer.png" rel="noreferrer">Here</a> that this palette only has 9 colours. So my question is, are the contourf levels limited by the amount of available colours in the colormap? I quite like this map and I wonder if it'd be possible to generate a new one like it but with more levels of red?</p>
  
  <p>I'm interested in being able to capture the variability of the data so more contour levels seems like a good idea but I'm keen on losing the rainbow scheme and just going with one based on a single colour.</p>
  
  <p>Cheers!</p>