title: matplotlib colorbar limits for contourf
body: <p>How do you set hard limits on colorbar used with contourf? The code below works as expected with colorbar limits set to <code>[-3, 3]</code> when using <code>plot_surface</code>, but with <code>contourf</code> the limits are not at the tips of the colorbar. I need this to create a gif from multiple images with a constant colorbar.</p>
  <pre><code>import matplotlib.pyplot as plt 
  import numpy as np
  
  fig = plt.figure()
  
  ax = fig.gca(projection='3d')
  CHI = np.linspace(-45, 45, 35);
  M = np.linspace(0, 1, 35) 
  CHI, M = np.meshgrid(CHI, M)
  R = 10*2*M*np.sin(  2 * np.deg2rad(CHI) )
  
  cont = ax.contourf(CHI, M, R)
  #cont = ax.plot_surface(CHI, M, R)
  cont.set_clim(vmin=-3, vmax=3)
  
  ax.set_xlim(-45,45)
  cbar = plt.colorbar(cont, ticks=[-3,-2,-1,0,1,2,3])
  plt.show()
  </code></pre>
  <p><a href="https://i.stack.imgur.com/MsjhC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MsjhC.png" alt="enter image description here" /></a>
  <a href="https://i.stack.imgur.com/mHIRd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mHIRd.png" alt="enter image description here" /></a></p>