title: How to increase color resolution in python matplotlib colormap
body: <p>I am making a colormap of a 2D numpy meshgrid:</p>
  
  <pre><code>X, Y = np.meshgrid(fields, frequencies)
  cs = ax.contourf(X, Y, fields_freqs_abs_grid, cmap="viridis", N=256)
  </code></pre>
  
  <p>The values in fields_freqs_abs_grid, which are plotted by color, have already been logarithmically scaled.</p>
  
  <p>The colormap produced by python's matplotlib is coarse -- it scales over 8 colors even though I use "N=256" for the number of RGB pixels. Increasing N to 2048 did not change anything. A plot using the MatLab language on the same data produces a colormap with significantly higher color resolution. How do I increase the number of colors mapped in Python?</p>
  
  <p>The result is: <a href="https://i.stack.imgur.com/eDLqy.png" rel="noreferrer"><img src="https://i.stack.imgur.com/eDLqy.png" alt="enter image description here"></a></p>
  
  <p>But I want the result to be: <a href="https://i.stack.imgur.com/ROzBU.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ROzBU.png" alt="enter image description here"></a></p>
  
  <p>Thank you!</p>