# problem with matplotlib and latex

hey people

i have an problem on plotting some functions with latex texts. i cant
plot some latex symbols like \bar or something else.... the normal latex
stuff works perect, but such keys doessent and i dont know why...

hope someone can help me

as you can see i attached a sample plot file... you find the latex
problem in line pl.ylabel() ... the \bar doessent work

here is the error message i got

mK_massnumber$python mK_massnumber1.py (3.196543428131772e-09, -4.8707876140789696e-08) /usr/lib/python2.6/dist-packages/matplotlib/texmanager.py:55: DeprecationWarning: os.popen4 is deprecated. Use the subprocess module. stdin, stdout = os.popen4('dvipng -version') Traceback (most recent call last): File "mK_massnumber1.py", line 79, in <module> pl.savefig('mK_massnumber1.eps') File "/usr/lib/python2.6/dist-packages/matplotlib/pyplot.py", line 345, in savefig return fig.savefig(*args, **kwargs) File "/usr/lib/python2.6/dist-packages/matplotlib/figure.py", line 990, in savefig self.canvas.print_figure(*args, **kwargs) File "/usr/lib/python2.6/dist-packages/matplotlib/backend_bases.py", line 1419, in print_figure **kwargs) File "/usr/lib/python2.6/dist-packages/matplotlib/backend_bases.py", line 1308, in print_eps return ps.print_eps(*args, **kwargs) File "/usr/lib/python2.6/dist-packages/matplotlib/backends/backend_ps.py", line 869, in print_eps return self._print_ps(outfile, 'eps', *args, **kwargs) File "/usr/lib/python2.6/dist-packages/matplotlib/backends/backend_ps.py", line 892, in _print_ps orientation, isLandscape, papertype) File "/usr/lib/python2.6/dist-packages/matplotlib/backends/backend_ps.py", line 1140, in _print_figure_tex orientation) File "/usr/lib/python2.6/dist-packages/matplotlib/backends/backend_ps.py", line 1227, 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/4255a479ce229709468650a987deaac6.tex LaTeX2e <2005/12/01> Babel <v3.8h> and hyphenation patterns for english, usenglishmax, dumylang, noh yphenation, ukrainian, russian, bulgarian, 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/geometry/geometry.sty (/usr/share/texmf-texlive/tex/xelatex/xetexconfig/geometry.cfg) 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)) (./4255a479ce229709468650a987deaac6.aux) (/usr/share/texmf-texlive/tex/latex/base/ts1cmr.fd) (/usr/share/texmf-texlive/tex/latex/psnfss/ot1pnc.fd) ! Text line contains an invalid character. l.38 ...r[rgb]{0.000,0.000,1.000} {\sffamily$^^H
ar a M_{K} /
<A_{part}> ...

<4255a479ce229709468650a987deaac6.eps>
(/usr/share/texmf-texlive/tex/latex/psnfss/ot1phv.fd)
! Extra }, or forgotten $. <argument> ...ffamily$ar a M_{K} / <A_{part}> \$} l.43 ...e=0]{4255a479ce229709468650a987deaac6.eps} ! Missing$ inserted.
<inserted text>
$l.43 ...e=0]{4255a479ce229709468650a987deaac6.eps} ! Missing } inserted. <inserted text> } l.43 ...e=0]{4255a479ce229709468650a987deaac6.eps} [1] (./4255a479ce229709468650a987deaac6.aux) ) (see the transcript file for additional information) Output written on 4255a479ce229709468650a987deaac6.dvi (1 page, 5532 bytes). Transcript written on 4255a479ce229709468650a987deaac6.log. mK_massnumber$ python mK_massnumber1.py
(3.196543428131772e-09, -4.8707876140789696e-08)
mK_massnumber$python mK_massnumber1.py (3.196543428131772e-09, -4.8707876140789696e-08) mK_massnumber1.py (1.86 KB) ··· ############################################################################################ here are the informations about my system:$ uname -a
Linux timo-laptop 2.6.28-11-generic #42-Ubuntu SMP Fri Apr 17 01:57:59
UTC 2009 i686 GNU/Linux

matplotlib version: 0.98.5.2

Try using raw strings?

···

On Wed, Aug 12, 2009 at 10:42 AM, Timo Spielmann<spielmann@...2727...> wrote:

hey people

i have an problem on plotting some functions with latex texts. i cant
plot some latex symbols like \bar or something else.... the normal latex
stuff works perect, but such keys doessent and i dont know why...

hope someone can help me

how i use raw settings ?

···

On Wed, Aug 12, 2009 at 10:42 AM, Timo > Spielmann<spielmann@...2727...> wrote:

hey people

i have an problem on plotting some functions with latex texts. i cant
plot some latex symbols like \bar or something else.... the normal latex
stuff works perect, but such keys doessent and i dont know why...

hope someone can help me

Try using raw strings?

Try googling "python raw strings" and read the first hit.

By the way, please post self-contained scripts that are as short as
possible. We can't run the script you posted, the data is missing.

···

On Wed, Aug 12, 2009 at 12:00 PM, <spielmann@...2727...> wrote:

how i use raw settings ?

On Wed, Aug 12, 2009 at 10:42 AM, Timo >> Spielmann<spielmann@...2727...> wrote:

hey people

i have an problem on plotting some functions with latex texts. i cant
plot some latex symbols like \bar or something else.... the normal latex
stuff works perect, but such keys doessent and i dont know why...

hope someone can help me

Try using raw strings?

--
"In our description of nature, the purpose is not to disclose the real
essence of the phenomena but only to track down, so far as it is
possible, relations between the manifold aspects of our experience" -
Niels Bohr

"It is a bad habit of physicists to take their most successful
abstractions to be real properties of our world." - N. David Mermin

"Once we have granted that any physical theory is essentially only a
model for the world of experience, we must renounce all hope of
finding anything like the correct theory ... simply because the
totality of experience is never accessible to us." - Hugh Everett III