Possible to use pyplot without DISPLAY?

lemur picture lemur · May 4, 2010 · Viewed 8.1k times · Source

I'm working remotely on a machine that's pretty restrictive. I can't install any software, and it won't accept my X11 session, so I have no display. The machine currently has pylab installed, and I'd like to use it to plot something and then save it for viewing on another computer. However, it seems there's no way to even create a plot without a display. Am I missing something?

Answer

wump picture wump · May 4, 2010

Use another backend, for example Agg or SVG:

import matplotlib
matplotlib.use('Agg')
...
matplotlib.savefig('out.png')