title: plotting a new graph after closing a first one in matplotlib
body: <p>I am working on a python script where I have the following method in an object Plotter :</p>
  
  <pre><code>import matplotlib.pyplot as plt
  class Plotter:
  
     def __init__(self):
         self.nbfig = 0
  
     def plot(self):
         self.nbfig += 1
         plt.figure(self.nbfig)
         plt.plot(self.time, self.angle, 'b')
         plt.ion()
         plt.show()
  </code></pre>
  
  <p>The python script is called by a real time C++ app whenever it needs to plot something (that is why i am using plt.ion() so that the plot runs in a different thread and does not stop the c++ app)
  However, sometimes the c++ app needs to refresh the app and calls the following method:</p>
  
  <pre><code>def refresh(self):
      if (self.nbfig &gt; 0): #meaning the c++ app already plotted a figure
          plt.close()
  </code></pre>
  
  <p>This method effectively close the matplotlib window where I plotted the angle. However, when it calls a second time the method plot (defined above), nothing gets plotted (an empty window appears).</p>
  
  <p>It seems that calling plt.close() affects the all behaviour of matplotlib (I tried to close manually the window and the script is able to plot different graphs one after the other)</p>
  
  <p>Have you ever encountered this kind of issue ?</p>
  
  <p>Thanks a lot for your help</p>
  
  <p>Best</p>
  
  <p>Vincent</p>