title: RuntimeError: Invalid DISPLAY variable
body: <p>I am running my python script in another machine by using <code>ssh</code> command in <code>linux</code>. I have also run this command :</p>
  
  <pre><code>source ~/.bashrc 
  </code></pre>
  
  <p>after logging in the other machine, in order to define the proper paths in the new machine. I was getting the error message for running the following python code lines even I have tried to follow the instruction in <a href="https://stackoverflow.com/questions/21321292/using-matplotlib-when-display-is-undefined">this question</a> by defining the backend.</p>
  
  <pre><code>&gt;&gt;&gt; import matplotlib
  &gt;&gt;&gt; import pylab as plt
  &gt;&gt;&gt; matplotlib.use('Agg')
  &gt;&gt;&gt; import numpy as np
  &gt;&gt;&gt; x=np.arange(0,2,0.001)
  &gt;&gt;&gt; y=np.sin(x)**2+4*np.cos(x)
  &gt;&gt;&gt; fig = plt.figure()
  &gt;&gt;&gt; plt.plot(x,y,'r.')     
  </code></pre>
  
  <p>The error message</p>
  
  <pre><code>This probably means that Tcl wasn't installed properly.
  Traceback (most recent call last):
    File "Systematic_Optimised.py", line 513, in &lt;module&gt;
      fig = plt.figure()
    File "/vol/anaconda/lib/python2.7/site-packages/matplotlib/pyplot.py", line 435, in figure
      **kwargs)
    File "/vol/anaconda/lib/python2.7/site-packages/matplotlib/backends/backend_qt4agg.py", line 47, in new_figure_manager
      return new_figure_manager_given_figure(num, thisFig)
    File "/vol/anaconda/lib/python2.7/site-packages/matplotlib/backends/backend_qt4agg.py", line 54, in new_figure_manager_given_figure
      canvas = FigureCanvasQTAgg(figure)
    File "/vol/anaconda/lib/python2.7/site-packages/matplotlib/backends/backend_qt4agg.py", line 72, in __init__
      FigureCanvasQT.__init__(self, figure)
    File "/vol/aibn84/data2/zahra/anaconda/lib/python2.7/site-packages/matplotlib/backends/backend_qt4.py", line 68, in __init__
      _create_qApp()
    File "/vol/anaconda/lib/python2.7/site-packages/matplotlib/backends/backend_qt5.py", line 138, in _create_qApp
      raise RuntimeError('Invalid DISPLAY variable')
  RuntimeError: Invalid DISPLAY variable
  </code></pre>
  
  <p>any suggestion how to fix the problem</p>