Plotting in batch with no display

Hans Georg Schaathun H.Schaathun at surrey.ac.uk
Sat Jun 5 03:14:13 EDT 2010


On Fri, 04 Jun 2010 22:27:33 -0000, exarkun at twistedmatrix.com
  <exarkun at twistedmatrix.com> wrote:
:  It's possible to plot with matplotlib without a display.  I'm not 
:  surprised you didn't figure out how, though, it's not all that obvious.

Thank you very much.  That's a good start.  Do you know of any good 
documentation on how to choose and use backends?  What I find
is very thin...

:  Check out the matplotlib.use function.  For example:
: 
:      import matplotlib
:      matplotlib.use('agg')
:      import pylab
:      pylab.plot([1, 3, 5])
:      fig = file('foo.png', 'wb')
:      pylab.savefig(fig, format='png')
:      fig.close()

Raster graphics is not good enough, I will need a backend which
does vector graphics and pdf output.  AFAICS from the FAQ at
sourceforge, agg only supports raster and png.  Cairo supports
vector graphics and PDF, but I cannot find any information about
how/if it deals with X11...

:-- George



More information about the Python-list mailing list