Adjust figure size with respect to the axes size?
<p>Let's say I create a simple plot with matplotlib </p>

<pre><code>import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)

plot stuff etc .. . 
</code></pre>

<p>After I finished the plotting routines I want to adjust the size of my figure (but keeping all aspect ratios the same), such that the total height of <code>ax</code> is set to a constant value i.e. 3 inches.
Is there a nice and short way to archieve this ? </p>

<p>EDIT: I know how to change the figure size, but here i want to adjust it according to the size of the axes.</p>