title: Matplotlib reuse figure created by another script
body: <p>I am using Matplotlib on MacOS with Sulime Text.
  I use <code>Python 3.5</code> and <code>Matplotlib 2.0</code>. </p>
  
  <p>When I work on a figure, I usually have a script that plot the data, and save the figure in a .pdf file with <code>plt.savefig()</code>. Then I use <code>Skim</code> (a pdf viewer) in order to refresh the file each time I modify and run the script. This allows me to set my working layout as clean as: there is one window for the script, and one window for the figure which is automatically refreshing. </p>
  
  <p>I would like to do keep the same layout, but using the Matplotlib figures (because they are interactive). I am looking for a way to use <code>plt.show()</code> but <strong>always in the same figure</strong> that has been created the first time I've run the script. </p>
  
  <p>For instance: </p>
  
  <h3>1. First run</h3>
  
  <pre class="lang-python prettyprint-override"><code>import matplotlib.pyplot as plt
  import numpy as np 
  
  fig, ax = plt.figure()    
  
  noise = np.random.rand(1, 100)
  ax(noise)
  plt.show()
  </code></pre>
  
  <h3>2. Following runs</h3>
  
  <pre class="lang-python prettyprint-override"><code>import matplotlib.pyplot as plt
  import numpy as np 
  
  # This is the super command I am looking for
  fig = plt.get_previous_run_figure()
  ax = fig.axes
  
  noise = np.random.rand(1, 100)
  ax.plot(noise)
  plt.draw()
  </code></pre>
  
  <p>In that case of course, I would have to do a first-run script separately from the main script. Does anyone know if it is possible ?</p>