title: Creating square subplots (of equal height and width) in matplotlib
body: <p>When I run this code</p>
  
  <pre><code>from pylab import *
  
  figure()
  ax1 = subplot(121)
  plot([1, 2, 3], [1, 2, 3])
  subplot(122, sharex=ax1, sharey=ax1)
  plot([1, 2, 3], [1, 2, 3])
  draw()
  show()
  </code></pre>
  
  <p>I get two subplots which are "squished" in the X-dimension. How do I get these subplots such that the height of the Y-axis equals the width of the X-axis, for both subplots?</p>
  
  <p>I am using matplotlib v.0.99.1.2 on Ubuntu 10.04.</p>
  
  <p><strong>Update 2010-07-08</strong>: Let's look at some things that don't work.</p>
  
  <p>After Googling around all day, I thought that it might be related to auto-scaling. So I tried fiddling with that.</p>
  
  <pre><code>from pylab import *
  
  figure()
  ax1 = subplot(121, autoscale_on=False)
  plot([1, 2, 3], [1, 2, 3])
  subplot(122, sharex=ax1, sharey=ax1)
  plot([1, 2, 3], [1, 2, 3])
  draw()
  show()
  </code></pre>
  
  <p>matplotlib insists on auto-scaling.</p>
  
  <pre><code>from pylab import *
  
  figure()
  ax1 = subplot(121, autoscale_on=False)
  plot([1, 2, 3], [1, 2, 3])
  subplot(122, sharex=ax1, sharey=ax1, autoscale_on=False)
  plot([1, 2, 3], [1, 2, 3])
  draw()
  show()
  </code></pre>
  
  <p>In this one, the data completely disappears. WTF, matplotlib? Just WTF?</p>
  
  <p>Okay, well maybe if we fix the aspect ratio?</p>
  
  <pre><code>from pylab import *
  
  figure()
  ax1 = subplot(121, autoscale_on=False)
  plot([1, 2, 3], [1, 2, 3])
  axes().set_aspect('equal')
  subplot(122, sharex=ax1, sharey=ax1)
  plot([1, 2, 3], [1, 2, 3])
  draw()
  show()
  </code></pre>
  
  <p>This one causes the first subplot to disappear entirely. That's hilarious! Who came up with that one?</p>
  
  <p>In all seriousness, now... should this really be such a hard thing to accomplish?</p>