title: adding ticks to matplotlib colorbar
body: <p>In the following simple code:</p>
  
  <pre><code>dat = np.linspace(0.1,0.9,4)*np.ones((4,1))
  fig, ax = plt.subplots()
  cax = ax.imshow(dat, interpolation='none')
  cbar = fig.colorbar(cax)
  plt.show()
  </code></pre>
  
  <p>which gives:</p>
  
  <p><a href="https://i.stack.imgur.com/YNKwl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YNKwl.png" alt="enter image description here"></a></p>
  
  <p>I want the colorbar to have the range [0,1]. This can be accomplished by:</p>
  
  <pre><code>dat = np.linspace(0.1,0.9,4)*np.ones((4,1))
  fig, ax = plt.subplots()
  cax = ax.imshow(dat, interpolation='none')
  cbar = fig.colorbar(cax)
  cbar.set_clim(0, 1)
  cbar.set_ticks(np.linspace(0,1,11))
  plt.show()
  </code></pre>
  
  <p>which results in:</p>
  
  <p><a href="https://i.stack.imgur.com/och1j.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/och1j.png" alt="enter image description here"></a></p>
  
  <p>Clearly the range was changed as the colors have become lighter, but the ticks have not changed, i.e. <code>cbar.set_ticks()</code> doesn't perform as expected. How can i change the tick marks?</p>