title: Creating and referencing separate matplotlib plots
body: <p>What's the best practice to create multiple separate plots using matplotlib, so they can be called later or output into a pdf report? I'm a bit unclear as to how to do this in a way that retains each plot in memory (like we could with dataframes) for later reference. </p>
  
  <p>Suppose we have this code:</p>
  
  <pre><code>%pylab inline
  x1 = np.random.randn(50)*100
  y1 = np.random.randn(50)*100
  x2 = np.random.randn(50)*100
  y2 = np.random.randn(50)*100
  </code></pre>
  
  <p>and the intent is to create 2 separate plots of (x1,y1) and (x2,y2) and 'save' them in some way to be referenced later. the intent is to be able to output these into a PDF (perhaps via reportlab). the relationship between "figures", "subplots" and "axes" is confusing to me and not sure what is optimal for this purpose. i started with an approach like:</p>
  
  <pre><code>plt.figure(1, figsize=(8, 6))
  plt.subplot(211)
  plt.scatter(x1, y1, c = 'r', alpha = 0.3)
  
  plt.subplot(212)
  plt.scatter(x2, y2, c = 'k', alpha = 0.7)
  plt.show()
  </code></pre>
  
  <p>which does technically work, but i'm not sure how i can refer to these later. also, i am using a small example here for illustration, but in practice i may have many more of these. </p>