title: Multiple matplotlib plots in same figure + in to pdf-Python
body: <p>I'm plotting some data based on pandas dataframes and series. Following is a part of my code. This code gives an error.</p>
  <pre><code>RuntimeError: underlying C/C++ object has been deleted
  
  
  from matplotlib import pyplot as plt
  from matplotlib.backends.backend_pdf import PdfPages
  fig = plt.figure()
  
  dfs = df['col2'].resample('10t', how='count')
  dfs.plot()
  plt.show()
  
  reg = df.groupby('col1').size()
  reg.sort()
  reg[-10:].plot(kind='barh')
  plt.show()
  
  pp = PdfPages('foo.pdf')
  fig.savefig(pp, format='pdf') 
  pp.close()
  </code></pre>
  <p>I have two questions.</p>
  <ol>
  <li>How to plot multiple plots in one output?(Here I get multiple outputs for each and every plot)</li>
  <li>How to write all these plots in to one pdf?</li>
  </ol>
  <p>I found <a href="https://stackoverflow.com/questions/11328958/matplotlib-pyplot-save-the-plots-into-a-pdf">this</a> as a related question.</p>