title: Matplotlib - Tcl_AsyncDelete: async handler deleted by the wrong thread?
body: <p>I'm asking this question because I can't solve one problem in <code>Python/Django</code> (actually in pure Python it's ok) which leads to <code>RuntimeError: tcl_asyncdelete async handler deleted by the wrong thread</code>. This is somehow related to the way how I render <code>matplotlib</code> plots in Django. The way I do it is:</p>
  
  <pre><code>...
  import matplotlib.pyplot as plt
  ...
  fig = plt.figure()
  ...
  plt.close()
  </code></pre>
  
  <p>I extremely minimized my code. But the catch is - even if I have just one line of code:</p>
  
  <pre><code>fig = plt.figure()
  </code></pre>
  
  <p>I see this RuntimeError happening. I hope I could solve the problem, If I knew the correct way of closing/cleaning/destroying plots in Python/Django. </p>