title: axis positioning with imshow - python
body: <p>I have been trying to add two axes on the same figure, with very specific locations. The problem is that when I add the plot, they seem to have different sizes to what I specified.</p>
  
  <p>Here is an example</p>
  
  <pre><code>fig = plt.figure()
  ax = fig.add_axes([0.0, 0.3, 0.7, 0.7])
  
  M = np.random.random([10, 20])
  ax.imshow(M)
  
  plt.show()
  </code></pre>
  
  <p>This is the result</p>
  
  <p><a href="https://i.stack.imgur.com/jztuA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jztuA.png" alt="enter image description here"></a></p>
  
  <p>However, when I use <code>ax.plot()</code> instead it seems to place the axis at the correct location. </p>
  
  <p><a href="https://i.stack.imgur.com/TEqA5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TEqA5.png" alt="enter image description here"></a></p>
  
  <p>My feeling is that it has to do with the aspect ratio in <code>imshow()</code> but nothing has worked for me so far. Any suggestions? Thanks in advance</p>