title: Does varying extent in imshow() lead to changes in pixel number while rendering the image?
body: <p>I went through the tutorial <a href="https://matplotlib.org/stable/tutorials/intermediate/imshow_extent.html" rel="nofollow noreferrer">origin and extent in imshow</a> and also through the documentation of <a href="https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.imshow.html#matplotlib.axes.Axes.imshow" rel="nofollow noreferrer">extent in imshow()</a>. It was mentioned there that <strong>pixels have unit size in data coordinates</strong>,<strong>their centers are on integer coordinates</strong>. Hence varying the extent parameter should control the number of pixels in the rendered image. I want to verify this. My idea is to make a 10x10x3 RGB data-array and plot it using <code>imshow()</code> with default extent. Then plot the same data-array with <code>imshow()</code>, but modifying extent to ensure a higher number of pixels. I am stuck when I am required to verify if the two rendered images indeed have a difference of pixel count.</p>
  <p>Below is the code to express the idea -</p>
  <pre><code>import numpy as np
  import matplotlib.pyplot as plt
  
  # Make a 10x10x3 RGB data-array
  x = np.linspace(1,10,10)
  X,Y = np.meshgrid(x,x)
  r = np.sqrt(X**2 + Y**2)
  R = X/r
  G = (np.sqrt(2*X*Y))/r
  B = Y/r
  data = np.stack([R,G,B],axis=-1)
  
  fig, (ax1,ax2) = plt.subplots(1,2)
  
  # image with supposedly lower pixels
  im1 = ax1.imshow(data,origin='lower')
  ax1.set_title('Lower expected pixel')
  
  # image supposedly higher pixels
  im2 = ax2.imshow(data,origin='lower',extent=(-0.5,99.5,-0.5,99.5))
  ax2.set_title('Higher expected pixel')
  </code></pre>
  <p><a href="https://i.stack.imgur.com/wHOmd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wHOmd.png" alt="Output" /></a></p>
  <p>My primary questions here are -</p>
  <ul>
  <li><strong>Is my guess &quot;changing extent changes pixel count&quot; correct?</strong></li>
  <li><strong>How to perform the verification that I referred to above?</strong></li>
  </ul>