Re: [Matplotlib-users] failed to save in 'eps' format when I use latex environment

2008-04-24 Thread Jouni K . Seppänen
Darren Dale <[EMAIL PROTECTED]> writes:

> pdf output uses dviread.py to parse the dvi files created by latex,
> get the font layout information, and place the glyphs. [...] there are
> some subtle and difficult to resolve limitations of dviread (like
> rendering greek letters in math mode) that have prevented us from
> using it everywhere. Jouni, would you care to comment?

The details are a little complicated, but yes, dviread.py lacks some
features of the font support in dvips. The PS backend calls dvips and so
gets to use all the font machinery in a modern TeX system, and dviread
doesn't (yet) implement all the features. Another potential problem is
that dviread makes more assumptions about the TeX system than the PS
backend, and I have only tested it on TeX Live on a Mac. Both TeX Live
and teTeX on a Unix-ish system should be fine, but I have no idea about
TeX implementations on Windows, or any commercial implementations.

For various reasons, I haven't had much time recently to hack on
matplotlib, but improving dviread is high on my todo list when I do find
the time.

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

-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] failed to save in 'eps' format when I use latex environment

2008-04-24 Thread Darren Dale
On Thursday 24 April 2008 08:53:47 am you wrote:
> Although the 'align' environment inside the figure environment does not
> cause any error,
> tt seems like that the 'put' command from the 'picture' environment in
> LaTeX does not
> accept \begin{something} ~ \end{something} or \[~\].
>
> As you pointed out, my problem is coming from the limitation in LaTeX.
>
> However, there are two things I do not understand still.
>
> First, saving a plot with the align environment in 'eps' format had worked
> in the previous
> version of matplotlib (0.90.1 from ubuntu gutsy 7.10). What has been
> changed?

Nothing with the latex support, as far as I can tell from the changelogs. 

> Secondly, saving in a 'png' or 'pdf' format works still. What's the
> difference?

Saving a ps or eps file goes through the procedure of embedding the figure in 
a latex document in order for PSFrags to do its job and convert some tags 
into actual text. That way you get scalable output. png just renders the text 
as images, not as text. pdf output uses dviread.py to parse the dvi files 
created by latex, get the font layout information, and place the glyphs. 
dviread was not available when we added support to the eps/*agg backends, it 
was contributed later by Jouni Seppanen. dviread is a simpler and more 
elegant approach than the way it is done in eps/*agg, but there are some 
subtle and difficult to resolve limitations of dviread (like rendering greek 
letters in math mode) that have prevented us from using it everywhere. Jouni, 
would you care to comment?

-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] failed to save in 'eps' format when I use latex environment

2008-04-23 Thread Darren Dale
On Wednesday 23 April 2008 11:35:36 am Yong-Duk Jin wrote:
> I'm using matplotlib 0.9.12 from ubuntu hardy 8.04.
>
> To take advantage of the LaTeX handling capability in matplotlib,
> I've added next two lines in /etc/matplotlib
>
> text.usetex : True
> text.latex.preamble :  \usepackage{amsmath}

If I may quote from the matplotlibrc file:

#text.latex.preamble :  
# IMPROPER USE OF THIS FEATURE WILL LEAD TO LATEX FAILURES
# AND IS THEREFORE UNSUPPORTED. PLEASE DO NOT ASK FOR HELP
# IF THIS FEATURE DOES NOT DO WHAT YOU EXPECT IT TO.

> Then, I tried next test code.
>
> from pylab import *
> x = []; y = []
> figure(figsize=(2,2))
> plot(x,y,label=r'$\theta=$0.0deg'); axis([0,1,0,1]); legend()
> text(0.5, 0.5, r'\begin{align*}x&=\alpha\\y&=\beta\end{align*}')
> savefig('test.eps')
>
> However, I've got the following error message without a resulting eps file.

It looks like the text line is a problem. Latex doesnt like use of align or 
eqnarray environments inside figures. It looks like a latex limitation, not 
matplotlib. On the other hand, if you can figure out how to make it work in 
latex, and can prove that it is a limitation in matplotlib, please let me 
know so we can fix it.

> 
>
> Traceback (most recent call last):
>   File "test.py", line 6, in 
> savefig('test.eps')
>   File "/usr/lib/python2.5/site-packages/matplotlib/pyplot.py", line 269,
> in savefig
> return fig.savefig(*args, **kwargs)
>   File "/usr/lib/python2.5/site-packages/matplotlib/figure.py", line 782,
> in savefig
> self.canvas.print_figure(*args, **kwargs)
>   File "/usr/lib/python2.5/site-packages/matplotlib/backend_bases.py", line
> 1195, in print_figure
> **kwargs)
>   File "/usr/lib/python2.5/site-packages/matplotlib/backend_bases.py", line
> 1099, in print_eps
> return ps.print_eps(*args, **kwargs)
>   File
> "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py", line
> 1018, in print_eps
> return self._print_ps(outfile, 'eps', *args, **kwargs)
>   File
> "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py", line
> 1041, in _print_ps
> orientation, isLandscape, papertype)
>   File
> "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py", line
> 1289, in _print_figure_tex
> orientation)
>   File
> "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py", line
> 1376, in convert_psfrags
> \nHere is the full report generated by LaTeX: \n\n%s'% fh.read())
> RuntimeError: LaTeX was not able to process your file:
> Here is the full report generated by LaTeX:
>
> This is pdfTeXk, Version 3.141592-1.40.3 (Web2C 7.5.6)
>  %&-line parsing enabled.
> entering extended mode
> (/tmp/8c18ecc500de49027f0ed1df1bec10b8.tex
> LaTeX2e <2005/12/01>
> Babel  and hyphenation patterns for english, usenglishmax, dumylang,
> noh
> yphenation, loaded.
> (/usr/share/texmf-texlive/tex/latex/base/article.cls
> Document Class: article 2005/09/16 v1.4f Standard LaTeX document class
> (/usr/share/texmf-texlive/tex/latex/base/size10.clo))
> (/usr/share/texmf-texlive/tex/latex/type1cm/type1cm.sty)
> (/usr/share/texmf-texlive/tex/latex/psnfss/helvet.sty
> (/usr/share/texmf-texlive/tex/latex/graphics/keyval.sty))
> (/usr/share/texmf-texlive/tex/latex/psnfss/courier.sty)
> (/usr/share/texmf-texlive/tex/latex/base/textcomp.sty
> (/usr/share/texmf-texlive/tex/latex/base/ts1enc.def))
> (/usr/share/texmf-texlive/tex/latex/amsmath/amsmath.sty
> For additional information on amsmath, use the `?' option.
> (/usr/share/texmf-texlive/tex/latex/amsmath/amstext.sty
> (/usr/share/texmf-texlive/tex/latex/amsmath/amsgen.sty))
> (/usr/share/texmf-texlive/tex/latex/amsmath/amsbsy.sty)
> (/usr/share/texmf-texlive/tex/latex/amsmath/amsopn.sty))
> (/usr/share/texmf-texlive/tex/latex/geometry/geometry.sty
>
> Package geometry Warning: Over-specification in `h'-direction.
> `width' (614.295pt) is ignored.
>
>
> Package geometry Warning: Over-specification in `v'-direction.
> `height' (794.96999pt) is ignored.
>
> ) (/usr/share/texmf-texlive/tex/latex/psfrag/psfrag.sty
> (/usr/share/texmf-texlive/tex/latex/graphics/graphics.sty
> (/usr/share/texmf-texlive/tex/latex/graphics/trig.sty)
> (/etc/texmf/tex/latex/config/graphics.cfg)
> (/usr/share/texmf-texlive/tex/latex/graphics/dvips.def)))
> (/usr/share/texmf-texlive/tex/latex/graphics/graphicx.sty)
> (/usr/share/texmf-texlive/tex/latex/graphics/color.sty
> (/etc/texmf/tex/latex/config/color.cfg)
> (/usr/share/texmf-texlive/tex/latex/graphics/dvipsnam.def))
> (./8c18ecc500de49027f0ed1df1bec10b8.aux)
> (/usr/share/texmf-texlive/tex/latex/base/ts1cmr.fd)
> (/usr/share/texmf-texlive/tex/latex/psnfss/ot1pnc.fd)
> <8c18ecc500de49027f0ed1df1bec10b8.eps>
> (/usr/share/texmf-texlive/tex/latex/psnfss/ot1phv.fd)
> ! Missing \endgroup inserted.
> 
> \endgroup
> l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}
>
> ! Missing } inserted.
> 
> 

[Matplotlib-users] failed to save in 'eps' format when I use latex environment

2008-04-23 Thread Yong-Duk Jin
I'm using matplotlib 0.9.12 from ubuntu hardy 8.04.

To take advantage of the LaTeX handling capability in matplotlib,
I've added next two lines in /etc/matplotlib

text.usetex : True
text.latex.preamble :  \usepackage{amsmath}

Then, I tried next test code.

from pylab import *
x = []; y = []
figure(figsize=(2,2))
plot(x,y,label=r'$\theta=$0.0deg'); axis([0,1,0,1]); legend()
text(0.5, 0.5, r'\begin{align*}x&=\alpha\\y&=\beta\end{align*}')
savefig('test.eps')

However, I've got the following error message without a resulting eps file.



Traceback (most recent call last):
  File "test.py", line 6, in 
savefig('test.eps')
  File "/usr/lib/python2.5/site-packages/matplotlib/pyplot.py", line 269, in
savefig
return fig.savefig(*args, **kwargs)
  File "/usr/lib/python2.5/site-packages/matplotlib/figure.py", line 782, in
savefig
self.canvas.print_figure(*args, **kwargs)
  File "/usr/lib/python2.5/site-packages/matplotlib/backend_bases.py", line
1195, in print_figure
**kwargs)
  File "/usr/lib/python2.5/site-packages/matplotlib/backend_bases.py", line
1099, in print_eps
return ps.print_eps(*args, **kwargs)
  File "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py",
line 1018, in print_eps
return self._print_ps(outfile, 'eps', *args, **kwargs)
  File "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py",
line 1041, in _print_ps
orientation, isLandscape, papertype)
  File "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py",
line 1289, in _print_figure_tex
orientation)
  File "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py",
line 1376, in convert_psfrags
\nHere is the full report generated by LaTeX: \n\n%s'% fh.read())
RuntimeError: LaTeX was not able to process your file:
Here is the full report generated by LaTeX:

This is pdfTeXk, Version 3.141592-1.40.3 (Web2C 7.5.6)
 %&-line parsing enabled.
entering extended mode
(/tmp/8c18ecc500de49027f0ed1df1bec10b8.tex
LaTeX2e <2005/12/01>
Babel  and hyphenation patterns for english, usenglishmax, dumylang,
noh
yphenation, loaded.
(/usr/share/texmf-texlive/tex/latex/base/article.cls
Document Class: article 2005/09/16 v1.4f Standard LaTeX document class
(/usr/share/texmf-texlive/tex/latex/base/size10.clo))
(/usr/share/texmf-texlive/tex/latex/type1cm/type1cm.sty)
(/usr/share/texmf-texlive/tex/latex/psnfss/helvet.sty
(/usr/share/texmf-texlive/tex/latex/graphics/keyval.sty))
(/usr/share/texmf-texlive/tex/latex/psnfss/courier.sty)
(/usr/share/texmf-texlive/tex/latex/base/textcomp.sty
(/usr/share/texmf-texlive/tex/latex/base/ts1enc.def))
(/usr/share/texmf-texlive/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/share/texmf-texlive/tex/latex/amsmath/amstext.sty
(/usr/share/texmf-texlive/tex/latex/amsmath/amsgen.sty))
(/usr/share/texmf-texlive/tex/latex/amsmath/amsbsy.sty)
(/usr/share/texmf-texlive/tex/latex/amsmath/amsopn.sty))
(/usr/share/texmf-texlive/tex/latex/geometry/geometry.sty

Package geometry Warning: Over-specification in `h'-direction.
`width' (614.295pt) is ignored.


Package geometry Warning: Over-specification in `v'-direction.
`height' (794.96999pt) is ignored.

) (/usr/share/texmf-texlive/tex/latex/psfrag/psfrag.sty
(/usr/share/texmf-texlive/tex/latex/graphics/graphics.sty
(/usr/share/texmf-texlive/tex/latex/graphics/trig.sty)
(/etc/texmf/tex/latex/config/graphics.cfg)
(/usr/share/texmf-texlive/tex/latex/graphics/dvips.def)))
(/usr/share/texmf-texlive/tex/latex/graphics/graphicx.sty)
(/usr/share/texmf-texlive/tex/latex/graphics/color.sty
(/etc/texmf/tex/latex/config/color.cfg)
(/usr/share/texmf-texlive/tex/latex/graphics/dvipsnam.def))
(./8c18ecc500de49027f0ed1df1bec10b8.aux)
(/usr/share/texmf-texlive/tex/latex/base/ts1cmr.fd)
(/usr/share/texmf-texlive/tex/latex/psnfss/ot1pnc.fd)
<8c18ecc500de49027f0ed1df1bec10b8.eps>
(/usr/share/texmf-texlive/tex/latex/psnfss/ot1phv.fd)
! Missing \endgroup inserted.

\endgroup
l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}

! Missing } inserted.

}
l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}

! Missing \endgroup inserted.

\endgroup
l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}

! Missing } inserted.

}
l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}


! LaTeX Error: There's no line here to end.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H   for immediate help.
 ...

l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}

! Missing $ inserted.

$
l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}

! Missing } inserted.

}
l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}

! Missing } inserted.

}
l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}

! Missing } inserted.

}
l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}

! Missing \cr