From: Darren D. <dd...@co...> - 2005-06-02 16:28:49
|
Hi William, On Thursday 02 June 2005 11:49 am, William Henney wrote: > Hi list > > On Wed, 2005-06-01 at 13:25 -0500, John Hunter wrote: > > >>>>> "Chris" =3D=3D 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.=20 Why is this? > The solution is to convert all fonts to outlines before=20 > 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=3Depswrite -dEPSFitPage \ > -sOutputFile=3Dnew.eps old.eps Coincidentally, I was just addressing the use of gs's epswrite this morning= on=20 the matplotlib-devel list. Unfortunately, epswrite will yield a file that=20 does not render well on screen. Given the increasing popularity of online=20 publication, it seems this approach for generating eps files would not be=20 acceptable to scientific journals either. > > 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 Could you give an example? In my experience, datafiles tend to get so=20 complicated that all of Matlabs tools were useless. I end up writing code=20 specific to every type that isnt as simple as a few comment lines that are= =20 ignored followed by a delimited array of data. =2D-=20 Darren S. Dale Bard Hall Department of Materials Science and Engineering Cornell University Ithaca, NY. 14850 dd...@co... http://people.ccmr.cornell.edu/~dd55/ |