From: William H. <wh...@gm...> - 2005-06-02 16:03:39
|
Hi list On Wed, 2005-06-01 at 13:25 -0500, John Hunter wrote: > >>>>> "Chris" == Chris Barker <Chr...@no...> writes: > > Chris> Wonderful! this is great news. How have you done it? Have > Chris> you written a DVI driver? or do you use TeX and associated > Chris> tools to create a bitmap and put that on the image? Or > Chris> something else? > > For *Agg, we use tex + dvipng and load the output as a transparent, > anti-aliased raster, caching the dvipng output in ~/.tex.cache for > efficiency. For PS, we use tex + dvips + psfrag + latex + a patched > ps2epsi. The latter is cumbersome, but it works. In an ideal world, > we would simply use tex + dvips but embedding the postscript fragments > generated by dvips in arbitrary locations on the figure, but this has > proved challenging. > Have you looked at how PyX (http://pyx.sourceforge.net/) handles things? They have excellent support for tex/latex labels and it seems to be implemented in a much "cleaner" way than you describe above. As far as I can see, they run a single TeX job containing all the strings from the current plot (see the texrunner class in pyx/text.py) and then parse the dvi output themselves (see pyx/dvifile.py) > Having our own dvi parser would be a nice solution. As you noted, the > format isn't too complicated, except for the font handling and the > fact that you need your own bytecode processing engine to extract the > information. We're waiting until Robert Kern has another boring > experiment to site through for this one. Well, PyX is GPLed so I don't see why you couldn't adopt their DVI parser. One thing you need to bear in mind if you are using TeX to generate PS output is that the resultant files will probably be unacceptable to many scientific journals without further processing. The production staff generally try to open the PS files in Adobe Illustrator and this causes multiple problems with files generated both by PyX and by dvips. The solution is to convert all fonts to outlines before submission (and also make sure all bbox coords are +ve). You can do this with recent versions of ghostscript: gs -dBATCH -dNOPAUSE -dSAFER -q -sDEVICE=epswrite -dEPSFitPage \ -sOutputFile=new.eps old.eps I suppose I should introduce myself since I haven't posted to this list before. I've been looking at various python scientific plotting packages for the last few months. I'm currently using gnuplot (supplemented by bash or python scripting) for interactive use and quick hacks, together with PyX for publication-quality output. Matplotlib looks very interesting since I think it could potentially replace both gnuplot and PyX. The features it seemed to be lacking the last time I looked in any detail (v 0.70) were 1. Good, flexible support for reading data from files 2. Publication-quality text handling for math and accented characters (i.e., full LaTeX support) It looks like you have now addressed point 2 at least, so I've just downloaded 0.81alpha from CVS and I'll see how it goes. The big advantages matplotlib has over PyX in my opinion are a more intuitive API and a larger/more-active developer pool and user base. Best wishes Will -- Dr William Henney, Centro de Radioastronomía y Astrofísica, Universidad Nacional Autónoma de México, Campus Morelia |