title: matplotlib plotting freezing in simple thread
body: <p>Been playing with plotting libraries for Python and came across matplotlib which seems to be battle tested and proven already. However I have came across a problem while creating a simple plot in a thread.</p>
  
  <p>In the example bellow, <strong>Dummy</strong> class <strong>plotme</strong> method is run in a thread twice in a row, but it gets stuck/freezes in 2nd iteration.
  Most likely is something obvious and related to the threading itself, but I failed to spot it so far.</p>
  
  <pre class="lang-py prettyprint-override"><code>import matplotlib.pyplot as plt
  from numpy import arange, sin, pi
  import threading
  
  class Dummy():
  
      def plotme(self, iteration = 1):
  
          print "%ix plotting... " % iteration,
          t = arange(0.0, 2.0, 0.01)
          s = sin(2*pi*t)
          plt.plot(t, s)
          plt.xlabel('time (s)')
          plt.ylabel('voltage (mV)')
          plt.title('About as simple as it gets, folks')
          #savefig("test.png") # irrelevant here
          plt.close()
  
      def threadme(self, iteration = 1):
  
          thread_plot = threading.Thread(target=self.plotme,
                                        args=(iteration,))
          thread_plot.start()
          thread_plot.join()
  
  dummy = Dummy()
  dummy.threadme(1)
  dummy.threadme(2)
  </code></pre>