title: Running a python script with cron, matplotlib error
body: <p>I am trying to run a python script using cron. The script runs without issue from the command line but has problems with matplotlib when run from cron. The error is below.</p>
  <p>Traceback (most recent call last):</p>
  <pre class="lang-none prettyprint-override"><code>File &quot;/home/ubuntu/python/spread.py&quot;, line 154, in &lt;module&gt;
      plot_spread(lat, lon, vals, mean, maxs, mins, stdp, stdm, ens_members)
    
  File &quot;/home/ubuntu/python/spread.py&quot;, line 81, in plot_spread
      plt.fill_between(x, maxs, stdp, color='r', alpha=0.2)
    
  File &quot;/usr/lib/python2.7/dist-packages/matplotlib-1.5.0_818.gfd83789-py2.7-linux-x86_64.egg/matplotlib/pyplot.py&quot;, line 2785, in fill_between
      ax = gca()
    
  File &quot;/usr/lib/python2.7/dist-packages/matplotlib-1.5.0_818.gfd83789-py2.7-linux-x86_64.egg/matplotlib/pyplot.py&quot;, line 928, in gca
      return gcf().gca(**kwargs)
    
  File &quot;/usr/lib/python2.7/dist-packages/matplotlib-1.5.0_818.gfd83789-py2.7-linux-x86_64.egg/matplotlib/pyplot.py&quot;, line 578, in gcf
      return figure()
    
  File &quot;/usr/lib/python2.7/dist-packages/matplotlib-1.5.0_818.gfd83789-py2.7-linux-x86_64.egg/matplotlib/pyplot.py&quot;, line 527, in figure
      **kwargs)
    
  File &quot;/usr/lib/python2.7/dist-packages/matplotlib-1.5.0_818.gfd83789-py2.7-linux-x86_64.egg/matplotlib/backends/backend_qt4agg.py&quot;, line 46, in new_figure_manager
      return new_figure_manager_given_figure(num, thisFig)
    
  File &quot;/usr/lib/python2.7/dist-packages/matplotlib-1.5.0_818.gfd83789-py2.7-linux-x86_64.egg/matplotlib/backends/backend_qt4agg.py&quot;, line 53, in new_figure_manager_given_figure
      canvas = FigureCanvasQTAgg(figure)
    
  File &quot;/usr/lib/python2.7/dist-packages/matplotlib-1.5.0_818.gfd83789-py2.7-linux-x86_64.egg/matplotlib/backends/backend_qt4agg.py&quot;, line 76, in __init__
      FigureCanvasQT.__init__(self, figure)
    
  File &quot;/usr/lib/python2.7/dist-packages/matplotlib-1.5.0_818.gfd83789-py2.7-linux-x86_64.egg/matplotlib/backends/backend_qt4.py&quot;, line 68, in __init__
      _create_qApp()
    
  File &quot;/usr/lib/python2.7/dist-packages/matplotlib-1.5.0_818.gfd83789-py2.7-linux-x86_64.egg/matplotlib/backends/backend_qt5.py&quot;, line 138, in _create_qApp
      raise RuntimeError('Invalid DISPLAY variable')
  
  RuntimeError: Invalid DISPLAY variable
  </code></pre>