title: Adjusting gridlines and ticks in matplotlib imshow
body: <p>I'm trying to plot a matrix of values and would like to add gridlines to make the boundary between values clearer.
  Unfortunately, imshow decided to locate the tick marks in the middle of each voxel. Is it possible to   </p>
  
  <p>a) remove the ticks but leave the label in the same location and<br>
  b) add gridlines between the pixel boundaries?</p>
  
  <pre><code>import matplotlib.pyplot as plt
  import numpy as np
  
  im = plt.imshow(np.reshape(np.random.rand(100), newshape=(10,10)),
                      interpolation='none', vmin=0, vmax=1, aspect='equal');
  ax = plt.gca();
  ax.set_xticks(np.arange(0, 10, 1));
  ax.set_yticks(np.arange(0, 10, 1));
  ax.set_xticklabels(np.arange(1, 11, 1));
  ax.set_yticklabels(np.arange(1, 11, 1));
  </code></pre>
  
  <p>Image without the gridline and with tick marks in the wrong location
  <a href="https://i.stack.imgur.com/axeto.png" rel="noreferrer"><img src="https://i.stack.imgur.com/axeto.png" alt="enter image description here"></a></p>
  
  <pre><code>ax.grid(color='w', linestyle='-', linewidth=2)
  </code></pre>
  
  <p>Image with gridlines in the wrong location:</p>
  
  <p><a href="https://i.stack.imgur.com/gPh7d.png" rel="noreferrer"><img src="https://i.stack.imgur.com/gPh7d.png" alt="enter image description here"></a></p>