title: How to export figures to files from IPython Notebook
body: <p>I use the IPython Notebook with the <code>--pylab inline</code> option, since I don't want plots to show up in a different window. Now I'd like to save the plots I see in the notebook to PDF or PNG files. </p>
  
  <p>Some code examples use</p>
  
  <pre><code>import matplotlib as plt
  
  plt.savefig("figure.png") # save as png
  </code></pre>
  
  <p>but this does not seem to work in inline mode. </p>
  
  <p>Of course I could simply save the PNG that is generated out of the browser, but I'd like to do this with a line of Python. I am also interested in PDF export.</p>