title: matplotlib.pyplot.imshow: removing white space within plots when using attributes "sharex" and "sharey"
body: <p>I have a problem which is similar to the one posted <a href="https://stackoverflow.com/questions/9120749/matplotlib-limits-when-using-plot-and-imshow-in-same-axes">here</a>.  The difference is that I get unwanted white spaces inside the plot area when I plot two subplots which share axes via the <code>sharex</code> and <code>sharey</code> attributes.  The white spaces persist even after setting <code>autoscale(False)</code>.  For example, using similar code as in the answer to the post mentioned above:</p>
  
  <pre><code>import matplotlib.pyplot as plt
  import numpy as np
  
  fig = plt.figure()
  ax = fig.add_subplot(2, 1, 1)
  ax.imshow(np.random.random((10,10)))
  ax.autoscale(False)
  ax2 = fig.add_subplot(2, 1, 2, sharex=ax, sharey=ax)   # adding sharex and sharey
  ax2.imshow(np.random.random((10,10)))
  ax2.autoscale(False)
  plt.show()
  </code></pre>
  
  <p>results in <a href="https://i.stack.imgur.com/ZBoWo.png" rel="nofollow noreferrer">this</a> image.</p>
  
  <p>I have also tried <code>ax.set_xlim(0, 10)</code> and <code>ax.set_xbound(0, 10)</code> as per suggestions <a href="https://stackoverflow.com/questions/13851410/editing-bounds-to-get-rid-of-white-space-within-a-plot-in-matplotlib">here</a>, but to no avail.  How can I get rid of the extra white spaces?    Any ideas would be appreciated.</p>