title: Imshow - splitted with different pixel sizes
body: <p>I try to get the following which should be illustrated in the figure below.</p>
  
  <p>Let us assume, for simplicity, I have a numpy array (10x10) which I want to plot with matplotlib imshow. The condition is to have different pixel sizes, for instance: the first five rows should have a size of 0.5cm the last five rows should have a size of 1cm. The columns should have the same size.</p>
  
  <p>How could I easly implement this? I already tried to do this, but I do not like this solution; in particular I still have white borders and zooming is terrible.</p>
  
  <pre><code>from matplotlib import pyplot as pl
  import numpy as np
  
  data = np.arange((100))
  data = np.reshape(data, (10,10))
  
  figure, (ax1, ax2) = pl.subplots(2, 1, sharex='col')
  figure.subplots_adjust(hspace=0)
  data1=data[5:10,:]
  ax1.imshow(data1, origin="lower", interpolation="none", aspect=0.5, extent=[-0.5,10.5,5.5,10.5], vmax=np.amax(data), vmin=np.amin(data))
  ax1.set_ylim([5.5,10.5])
  ##
  data2=data[0:5,:]
  ax2.imshow(data2, origin="lower", interpolation="none", aspect=1, extent=[-0.5,10.5,-0.5,5.5], vmax=np.amax(data), vmin=np.amin(data))
  ax2.set_ylim([-0.5,5.5])
  pl.show()
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/1K67e.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1K67e.png" alt="Output of the code"></a>
  Thanks
  <a href="https://i.stack.imgur.com/IKHju.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IKHju.png" alt="Example for different pixel sizes / desired picture"></a></p>