title: Django and Matplotlib: signal only works in main thread
body: <p>In <code>views.py</code> of my Django project, at a certain point in the code, I want to display a graph plot on the server to visualise in real-time the user input. So, I created another file <code>plotter.py</code> in the same folder as <code>views.py</code>, with the following content to display a simple graph:</p>
  
  <p>import numpy
  import matplotlib.pyplot</p>
  
  <pre><code>def plot():
      N = 50
      x = numpy.random.rand(N)
      y = numpy.random.rand(N)
      colors = numpy.random.rand(N)
      area = numpy.pi * (15 * numpy.random.rand(N))**2
      matplotlib.pyplot.scatter(x, y, s=area, c=colors, alpha=0.5)
      matplotlib.pyplot.show()
  </code></pre>
  
  <p>Then, in <code>views.py</code>, I <code>import plotter</code>, and then at my desired point in the file, I have <code>plotter.plot()</code>. However, this gives the following error:</p>
  
  <pre><code>Request Method:     POST
  Request URL:    http://localhost:8000/teacher/
  Django Version:     1.7
  Exception Type:     ValueError
  Exception Value:    
  
  signal only works in main thread
  
  Exception Location:     C:\Anaconda\lib\site-packages\matplotlib\backends\backend_qt5.py in mainloop, line 150
  Python Executable:  C:\Anaconda\python.exe
  Python Version:     2.7.8
  </code></pre>
  
  <p>How can I achieve this without causing such an error?</p>