title: Pixels cut off when using matplotlib imshow while in Jupyter Notebook
body: <p>I've used pyplot.imshow plenty of times, but I've never encountered this issue in the past when plotting grids of values with imshow. When plotting a small image with ticks/labels adjusted to be located at the center of each pixel edge, the resulting image cuts off half of the top and bottom rows of pixels.</p>
  
  <p>Ideally, I'd have ticks and labels centered on the edge of each pixel and all pixels would be displayed in full, square size without being cut off.</p>
  
  <p>I'm running a Jupyter notebook with this working example: </p>
  
  <pre><code>%matplotlib notebook
  import numpy as np
  import matplotlib.pyplot as plt
  
  fig, ax = plt.subplots(1,2)
  ax[0].imshow(np.arange(9).reshape((3,3)))
  ax[0].set(xticks=np.arange(3),
            xticklabels=['D', 'E', 'F'], yticklabels=['', 'A', '', 'B', '', 'C' ''])
  ax[0].set_title('Pixels with undesirable ticks')
  
  im1 = ax[1].imshow(np.arange(9).reshape((3,3)))
  ax[1].set(xticks=np.arange(3), yticks=np.arange(3),
         xticklabels=['D', 'E', 'F'], yticklabels=['A', 'B', 'C'])
  ax[1].set_title('Cut off pixels with desired ticks')
  plt.show()
  </code></pre>
  
  <p>This results in the following image, where I want the full image like that on the left, but the ticks and labels centered in each pixel like that on the right:</p>
  
  <p><a href="https://i.stack.imgur.com/Q6huo.png" rel="nofollow noreferrer">3x3 image examples</a></p>
  
  <p>(Edit)
  After some more testing, I can fix the problem by including the extent parameter in the call to imshow:</p>
  
  <pre><code>ax[1].imshow(np.arange(9).reshape((3,3)), extent=[-0.5, 2.5, -0.5, 2.5])
  </code></pre>
  
  <p>or by explicitly setting the extent:</p>
  
  <pre><code>im1.set_extent([-0.5, 2.5, -0.5, 2.5])
  </code></pre>
  
  <p>So... why is the default extent not showing up square?</p>