On Thursday 07 June 2007 10:06:03 pm Stephan Bourduas wrote:
> Hello,
>
> I've been using Matplotlib to generate postscript (eps) graphics which I
> import into my latex documents.  I tried using Latex to typeset
> mathematical symbols on my plots using the steps described here:
>
> http://www.scipy.org/Cookbook/Matplotlib/UsingTex
>
> The problem (I think) is that the eps files are genrated using dvipng,
> which results in ugly figures in the final PDF output. Is there a way to
> get Matplotlib to *not* use dvipng as the backend?

matplotlib only uses dvipng to render the text on screen in the plot window. 
Postscript file generation does not use dvipng. We paste in some tags and use 
the latex package psfrag to replace the tags with the text.

> On the other hand, if I
> uncomment the "rc('text', usetex=True)" line in the script so that Latex is
> used for the fonts, I get the following when converting the resulting EPS
> file to PDF:
>
> =======================
> $ ps2pdf test.eps
> $ pdffonts test.pdf
> name                                 type         emb sub uni object ID
> ------------------------------------ ------------ --- --- --- ---------
>
> =======================
>
> As you can see, there's no font embedding in this case and the image looks
> bad when previewed in either Ghotsview (eps) or in PDF.  Does anyone know
> if it's possible to get Matplotlib + Latex font embedding to work?

Unfortunately, psfrag produces postscript that can not be embedded in another 
file, so we have to distill the output. By default, the ghostscript distiller 
is used, but if you have pdftops (available with xpdf), you can set the 
ps.usedistiller option to xpdf and the fonts will be embedded. This is 
discussed at http://www.scipy.org/Cookbook/Matplotlib/UsingTex.

Darren


-- 
Darren S. Dale, Ph.D.
[EMAIL PROTECTED]

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to