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)
############################################################################################
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
#!/usr/bin/python
# -*- coding: utf8 -*-
import numpy as np
import pylab as pl
import string
import matplotlib
import scipy as sp
from scipy import stats
#from matplotlib import rc
matplotlib.rc('text', usetex = False)
# funktion zum einlesen der daten
def readXY(filename):
x,y = pl.load(filename, unpack=True)
return x,y
# funktion
def kpfit(x):
return (4.3793709787705581e-06+7.8272225529223599e-07*x)
def kmfit(x):
return -4.8707876140789696e-08+3.196543428131772e-09*x
(x_a, y_a) = readXY("mK-massnumbera.dat")
(x_b, y_b) = readXY("mK-massnumberb.dat")
#x = pl.array([ 0, 50, 100, 200])
#pkfitx = pl.array( [0, 200 ])
xx = np.linspace(0,250, 500)
xx1 = np.linspace(20,250, 500)
# berechnen
y_a[0]=y_a[0]/6.0
y_a[1]=y_a[1]/12.0
y_a[2]=y_a[2]/24.0
y_a[3]=y_a[3]/58.0
y_a[4]=y_a[4]/107.0
y_a[5]=y_a[5]/197.0
y_b[0]=y_b[0]/24.0
y_b[1]=y_b[1]/58.0
y_b[2]=y_b[2]/107.0
y_b[3]=y_b[3]/197.0
#m,b = np.polyfit(x_a,y_a,1)
m1,b1 = np.polyfit(x_b,y_b,1)
#print(xx, kpfit(xx))
print(m1,b1)
#(a_s,b_s,r,tt,stderr)=stats.linregress(t,x_a)
# plotten
pl.plot(x_a, y_a, 'ro')
pl.plot(x_b, y_b, 'b^', linewidth=3.0)
pl.plot(xx, kpfit(xx), 'r-', lw=2)
pl.plot(xx1, kmfit(xx1), 'b-', lw=2)
#pl.plot(t, x_a,'--k')
pl.semilogy()
pl.axis([-50.0 , 300.0 , 0.0000000001 , 1])
#pl.semilogy()
pl.xlabel('$Massnumber A$', {'color' : 'b', 'fontsize' : 20 })
pl.ylabel(' $\bar a M_{K} / <A_{part}> \$', {'color' : 'b', 'fontsize' : 20 })
pl.text(170.0, 0.00000001, '$\sqrt{s}=2.30 \ GeV$', fontsize=20)
pl.text(170.0, 0.000000001, '$imp. \ 0.0$', fontsize=20)
#pl.text(2.8, 0.1, '$K^{+}testest$', fontsize=20)
#legende
pl.legend(('$K^{+}$', '$K^{-}$'), loc = ('upper left'))
ltext = pl.gca().get_legend().get_texts()
pl.setp(ltext[0], fontsize = 20, color = 'r')
pl.setp(ltext[1], fontsize = 20, color = 'b')
#pl.figsize(5, 5)
pl.savefig('mK_massnumber1ps')
pl.savefig('mK_massnumber1.eps')
pl.show()
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users