title: matplotlib: can I create AxesSubplot objects, then add them to a Figure instance?
body: <p>Looking at the <code>matplotlib</code> documentation, it seems the standard way to add an <code>AxesSubplot</code> to a <code>Figure</code> is to use <code>Figure.add_subplot</code>:</p>
  
  <pre><code>from matplotlib import pyplot
  
  fig = pyplot.figure()
  ax = fig.add_subplot(1,1,1)
  ax.hist( some params .... )
  </code></pre>
  
  <p>I would like to be able to create <code>AxesSubPlot</code>-like objects independently of the figure, so I can use them in different figures. Something like</p>
  
  <pre><code>fig = pyplot.figure()
  histoA = some_axes_subplot_maker.hist( some params ..... )
  histoA = some_axes_subplot_maker.hist( some other params ..... )
  # make one figure with both plots
  fig.add_subaxes(histo1, 211)
  fig.add_subaxes(histo1, 212)
  fig2 = pyplot.figure()
  # make a figure with the first plot only
  fig2.add_subaxes(histo1, 111)
  </code></pre>
  
  <p>Is this possible in <code>matplotlib</code> and if so, how can I do this?</p>
  
  <p><strong>Update:</strong> I have not managed to decouple creation of Axes and Figures, but following examples in the answers below, can easily re-use previously created axes in new or olf Figure instances. This can be illustrated with a simple function:</p>
  
  <pre><code>def plot_axes(ax, fig=None, geometry=(1,1,1)):
      if fig is None:
          fig = plt.figure()
      if ax.get_geometry() != geometry :
          ax.change_geometry(*geometry)
      ax = fig.axes.append(ax)
      return fig
  </code></pre>