title: Using passed axis objects in a matplotlib.pyplot figure?
body: <p>I am currently attempting to use passed axis object created in function, e.g.:</p>
  
  <pre><code>def drawfig_1():
      import matplotlib.pyplot as plt
  
      # Create a figure with one axis (ax1)
      fig, ax1 = plt.subplots(figsize=(4,2))
  
      # Plot some data
      ax1.plot(range(10))
  
      # Return axis object
      return ax1
  </code></pre>
  
  <p>My question is, how can I use the returned axis object, ax1, in another figure? For example, I would like to use it in this manner:</p>
  
  <pre><code># Setup plots for analysis
  fig2 = plt.figure(figsize=(12, 8))
  
  # Set up 2 axes, one for a pixel map, the other for an image
  ax_map = plt.subplot2grid((3, 3), (0, 0), rowspan=3)
  ax_image = plt.subplot2grid((3, 3), (0, 1), colspan=2, rowspan=3)
  
  # Plot the image
  ax_psf.imshow(image, vmin=0.00000001, vmax=0.000001, cmap=cm.gray)
  
  # Plot the map
  ????      &lt;----- #I don't know how to display my passed axis here...
  </code></pre>
  
  <p>I've tried statements such as:</p>
  
  <pre><code>ax_map.axes = ax1
  </code></pre>
  
  <p>and although my script does not crash, my axis comes up empty. Any help would be appreciated!</p>