latex labels on saved plots

Jordan Atlas <jca33@...163...> writes:

Now, when I try to save a PDF (with the newer version of matplotlib), I
get the error:

[...]

  File "C:\Python24\Lib\site-packages\matplotlib\backend_bases.py", line
383, in draw_tex
    raise NotImplementedError
NotImplementedError

That means you are trying to call TeX, which is not supported by that
version of the pdf backend.

I get the same error as in my original post when trying to save an EPS:

[...]

RuntimeError: ghostscript was not able to process your image.
Here is the full report generated by ghostscript:

Do you have ghostscript installed? If you set verbose.level to debug or
debug-annoying, what do you get?

Do you mean the (TeX-like) mathtext format parsed by
matplotlib?

I guess I mean TeX-like mathtext format parsed by matplotlib. For
example, I'm using things like this:

rc('text', usetex=True)
Plotting.xlabel(r'\textbf{Time (s)}', fontsize=16)

usetex=True means that you are trying to use an external TeX program.

···

--
Jouni K. Sepp�nen
http://www.iki.fi/jks

Do you have ghostscript installed? If you set verbose.level to debug or
debug-annoying, what do you get?

I realized that the ghostscript path wasn't set up properly, so that was what was causing part of the problem with EPS files. It works sometimes now (sometimes the EPS is just a blank file, even though the plot shows up properly when I do pylab.show(). I'm still trying to narrow down what ameks the difference here).

I guess I mean TeX-like mathtext format parsed by matplotlib. For example, I'm using things like this:

rc('text', usetex=True) Plotting.xlabel(r'\textbf{Time (s)}', fontsize=16)
   
usetex=True means that you are trying to use an external TeX program.

Ok, so am I to understand that usetex=True is not supported for PDF/EPS output? Can you explain what the "Tex-like mathtext format parsed by matplotlib" is?

Thank you for your assistance,

--Jordan

Jordan Atlas wrote:

Ok, so am I to understand that usetex=True is not supported for PDF/EPS output?

In 0.90.1, it is not supported in PDF.

Can you explain what the "Tex-like mathtext format parsed by matplotlib" is?

matplotlib also has a built-in math formatting engine that does not use TeX itself. You can use it by leaving "usetex=False" (the default) and putting a '$' at the beginning and end of your TeX strings.

   Plotting.xlabel(r'$\alpha^2$')

Unfortunately, the built-in engine only supports a subset of what TeX can do. That subset is much smaller in 0.90.1 than in the current SVN, where much progress has recently been made.

See here for information pertaining to version 0.90.1:

   http://matplotlib.sourceforge.net/matplotlib.mathtext.html

Cheers,
Mike

···

--
Michael Droettboom
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

usetex=true IS supported for eps. I use epstopdf to get pdf's from there.

Ryan

···

On 9/21/07, Jordan Atlas <jca33@...163...> wrote:

>Do you have ghostscript installed? If you set verbose.level to debug or
>debug-annoying, what do you get?
>
>
>

I realized that the ghostscript path wasn't set up properly, so that was
what was causing part of the problem with EPS files. It works sometimes
now (sometimes the EPS is just a blank file, even though the plot shows
up properly when I do pylab.show(). I'm still trying to narrow down
what ameks the difference here).

>>I guess I mean TeX-like mathtext format parsed by matplotlib. For
>>example, I'm using things like this:
>>
>>rc('text', usetex=True)
>>Plotting.xlabel(r'\textbf{Time (s)}', fontsize=16)
>>
>>
>
>usetex=True means that you are trying to use an external TeX program.
>
>
>

Ok, so am I to understand that usetex=True is not supported for PDF/EPS
output? Can you explain what the "Tex-like mathtext format parsed by
matplotlib" is?

Thank you for your assistance,

--Jordan

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users