Generating and saving figures without actually displaying them

Hello,

I want to run a python program on a remote machine via ssh. It generates figures and saves them to files. I don't need/want to see the figures as they are being generated and saved.

When I do this on the remote machine (which is running linux) I get a display error

_tkinter.TclError: no display name and no $DISPLAY environment variable

Is there a way to disable drawing on the device and just have 'virtual' drawing to a file?

thanks!
-Kaushik

Try using the agg backend

···

On Friday 18 May 2007 12:39:29 pm kaushik.ghose wrote:

Hello,

I want to run a python program on a remote machine via ssh. It generates
figures and saves them to files. I don't need/want to see the figures as
they are being generated and saved.

When I do this on the remote machine (which is running linux) I get a
display error

_tkinter.TclError: no display name and no $DISPLAY environment variable

Is there a way to disable drawing on the device and just have 'virtual'
drawing to a file?

Darren Dale wrote:

Is there a way to disable drawing on the device and just have 'virtual'
drawing to a file?

Try using the agg backend

Which you can do by either:

  * changing the default backend in .matplotlibrc

or

  * Putting:
import matplotlib
matplotlib.use("Agg")

at the top of your script, BEFORE any mpl calls, including "import pylab", if indeed you import pylab at all.

-Chris

···

On Friday 18 May 2007 12:39:29 pm kaushik.ghose wrote:

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@...259...