title: Change pixel shape in matplotlib imshow function
body: <p>I am trying to reproduce a figure from a paper in matplotlib, shown below. Basically, each cell has a percentage in it, and the higher the percentage, the darker the background of the cell:</p>
  
  <p><a href="https://i.stack.imgur.com/KOYOH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KOYOH.png" alt="enter image description here"></a></p>
  
  <p>The code below produces something similar, but each cell is a square pixel and I would like for them to be flatter rectangles rather than squares, as in the above image. How can I achieve this with matplotlib? </p>
  
  <pre><code>import numpy as np
  import matplotlib.pyplot as plt
  import itertools
  
  table = np.random.uniform(low=0.0, high=1.0, size=(10,5))
  
  class_names = ['airplane', 'automobile', 'bird', 'cat', 'deer', 'dog', 'frog', 'horse', 'ship', 'truck']
  
  plt.figure()
  plt.imshow(table, interpolation='nearest', cmap=plt.cm.Greys, vmin=0, vmax=1)
  plt.yticks(np.arange(10), class_names)
  
  for i,j in itertools.product(range(table.shape[0]), range(table.shape[1])):
      plt.text(j, i, format(table[i,j], '.2f'),
               horizontalalignment="center",
               color="white" if table[i,j] &gt; 0.5 else "black")
  
  plt.show()
  </code></pre>
  
  <p>Here's what this code above produces:
  <a href="https://i.stack.imgur.com/tmLXv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tmLXv.png" alt="enter image description here"></a></p>
  
  <p>I suspect that changing the <code>aspect</code> and the <code>extent</code> for <code>imshow</code> may help me here. I don't fully understand how this works, but here's what I've tried:</p>
  
  <p><code>plt.imshow(table, interpolation='nearest', cmap=plt.cm.Greys, vmin=0, vmax=1, aspect='equal', extent=[0,14,10,0])</code></p>
  
  <p>This produces the following:
  <a href="https://i.stack.imgur.com/vEy1q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vEy1q.png" alt="enter image description here"></a></p>
  
  <p>I realise that I also need to add the borders between the cells, remove the tick marks, and change the values to percentages rather than decimals, and I am confident that I will be able to do this by myself, but if you want to help me out with that too then please feel free!</p>