title: Interactive plotting with Python via command line
body: <p>I am trying to use Python and the numpy and matplotlib libraries to do some data analysis and plotting and view my plots, adjust my code accordingly etc. So I need to be able to examine the plot.  However, running the script from the command line causes the figure to pop up momentarily then instantly disappear.  Another answer suggested to add a <code>raw_input("text here")</code> line at the end of the program to force python to wait for input and hold the plots open.  This does hold the plot windows open for me but the actual plots disappear and I just get an empty gray figure window while python waits for input.</p>
  
  <p>I'm running <strong>MAC OS X 10.8.3</strong> and using the <strong>terminal v2.3</strong> and my python installation is <strong>python 2.7.3</strong></p>
  
  <pre><code>import matplotlib.pylab as plt
  import numpy as np
  
  [ .. bunch of calculations .. ]
  
  plt.ion()
  plt.figure("Test Figure")
  plt.plot(xspace[:],vals[:,50])
  
  raw_input("press key to exit")
  </code></pre>