Plotting in batch with no display

Mark Lawrence breamoreboy at yahoo.co.uk
Mon Jun 7 18:05:46 EDT 2010


On 07/06/2010 08:41, Hans Georg Schaathun wrote:
> On Sat, 5 Jun 2010 16:10:01 +0000 (UTC), Tim Harig
>    <usernet at ilthio.net>  wrote:
> :  On 2010-06-05, Hans Georg Schaathun<H.Schaathun at surrey.ac.uk>  wrote:
> :>  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...
> :
> :  1. I am not familiar with matlab;
>
> Good that my question did not concern matlab then :-)
>
> :                                    but, I have written python programs that
> :  	generate plots using GNUplot (which can create PDFs).  There are
> :  	python modules available for working with GNUplot or you can open
> :  	it yourself under a subprocess and send it commands through a pipe.
> :  	GNUplot allows you to save files directly and does not therefore
> :  	require X.
>
> That certainly is an option.  I actually do have an example using
> gnuplot, taken from the libsvm tools which I wanted to replace with
> a native python solution :-)  After some testing, I have concluded
> though, that that's not necessary.  OTOH, gnuplot is not quite as
> easy to learn as the pyplot API.

I entirely agree with this comment.

>
> :  2. If you can generate a raster file with Matlab, you can use ImageMagick
> :  	(which has python bindings or could be execed directly) or other
> :  	conversion software to convert the file to whatever format you
> :  	choose.
>
> Sorry, that's no help.  Firstly, when I started using python it was to
> avoid using matlab...  Secondly, raster graphics gives poor quality when
> it is scaled.  Raster graphics represented in PDF or EPS is no better
> than raster graphics in PNG.  I need scalable vector graphics.
>
> :  3. Depending on your requirements, you could generate a plot using
> :  	postscript.  Postscript is  easy to convert directly to PDF as
> :  	the two are closely related. As postscript is a powerful
> :  	language itself you can actually write the graphing routines in
> :  	postscript and use python to simply embed the data into the
> :  	postscript.
>
> Sure, but the problem is to find the right matplotlib engine to do
> that.  We live in 2010 and Python is a new and evolving language.
> It would be strange if the PS renderer is more advanced than the
> PDF renderer, but if it is, I'll use it.
>
> Ideally, I'd like the option to switch between X11 and file output
> runtime, which the engine switch (matplotlib.use()) does not support.
> Question is, is there an engine to do that?
>
> :-- George

For more specific data have you tried the matplotlib specific mailing 
list at e.g. gmane.comp.python.matplotlib.general.

Apologies if this has been suggested in this thread and I've missed it.

Kindest regards.

Mark Lawrence.




More information about the Python-list mailing list