From: Chris B. <Chr...@no...> - 2005-06-02 17:09:34
|
William Henney wrote: > 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. Because matplotlib isn't GPL'd. It would probably be worth asking the PyX developers if they'd be willing to share the code under another license (essentially the python license), however. > 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 This really isn't a plotting issue, it's an IO issue. there's some good stuff in SciPy for this. I've also written a fast file scanner, kind of like Matlab's fscanf. Someone asked if they could put it in SciPy, but I'm not sure if it ever made there. Let me know if you want it. Also, Python itself provides everything you need to read files. > 2. Publication-quality text handling for math and accented characters > (i.e., full LaTeX support) Yeah, this is cool. I only wish that there was a designed-to-be-embedded TeX distribution out there. There are all kinds of applications for it, and requiring a full TeX distro is a pretty big burden for folks that don't use it already. Of course, if they do, then this is an easy way to get great typesetting. -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chr...@no... |