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?
Asked
Active
Viewed 8,404 times
2 Answers
26
Use another backend, for example Agg or SVG:
import matplotlib
matplotlib.use('Agg')
...
matplotlib.savefig('out.png')

wump
- 4,277
- 24
- 25
-1
Yes, after creating the plots etc., instead of calling
pylab.show()
call
pylab.savefig('filename.XXX')
where XXX is one of the common image extensions (png, jpg...)

janneb
- 36,249
- 2
- 81
- 97
-
1Hi, thanks! Is the way to create a plot pylab.plot()? Because even that call seems to be giving me errors, saying that I have no $DISPLAY variable set. – lemur May 04 '10 at 14:42