From: Florian L. <mai...@xg...> - 2010-01-29 19:49:58
|
Hello, I try to use LaTeX in my plot. I follow the instructions from http://www.scipy.org/Cookbook/Matplotlib/UsingTex florian@horus:~> cat .matplotlib/matplotlibrc text.usetex : true My plotting code looks like: Ma = arange(1.0, 5.0, 0.01) Ts = [T(i) for i in Ma] # BTW: Is there a way to spare this line? plot(Ma, Ts, label=r'/frac{T2}{T1}') Running the script gives: python Stossverlauf.py --verbose-helpful $HOME=/home/florian CONFIGDIR=/home/florian/.matplotlib matplotlib data path /usr/lib64/python2.6/site-packages/matplotlib/mpl-data loaded rc file /home/florian/.matplotlib/matplotlibrc matplotlib version 0.99.1.1 verbose.level helpful interactive is False units is False platform is linux2 Using fontManager instance from /home/florian/.matplotlib/fontList.cache /usr/lib/python2.6/site-packages/pytz/tzinfo.py:5: DeprecationWarning: the sets module is deprecated from sets import Set backend Agg version v2.2 and that's all, no plot window appears, the script is finished. If I remove the matplotlibrc everything works fine (of course no LaTeX). I think all the necessary programs are in place: florian@horus:~> which latex /usr/local/bin/latex florian@horus:~> which dvipng /usr/local/bin/dvipng florian@horus:~> which gs /usr/bin/gs Any idea what could be wrong? Thanks, Florian |
From: Sebastian B. <web...@th...> - 2010-01-29 20:00:18
Attachments:
signature.asc
|
Florian Lindner wrote: > Hello, > > I try to use LaTeX in my plot.... > > florian@horus:~> cat .matplotlib/matplotlibrc > text.usetex : true > > My plotting code looks like: > > Ma = arange(1.0, 5.0, 0.01) > Ts = [T(i) for i in Ma] # BTW: Is there a way to spare this line? not sure what T is. you could try T(Ma); you can do that of course also directly in the plot command > plot(Ma, Ts, label=r'/frac{T2}{T1}') should be backslash and math mode: plot(Ma, Ts, label=r'$\frac{T2}{T1}$') legend() show() > and that's all, no plot window appears, the script is finished. you did not show() ! best, sebastian. |
From: Florian L. <mai...@xg...> - 2010-01-30 18:22:28
|
Am Freitag, 29. Januar 2010 21:00:04 schrieb Sebastian Busch: > Florian Lindner wrote: > > Hello, > > > > I try to use LaTeX in my plot.... > > > > florian@horus:~> cat .matplotlib/matplotlibrc > > text.usetex : true > > > > My plotting code looks like: > > > > Ma = arange(1.0, 5.0, 0.01) > > Ts = [T(i) for i in Ma] # BTW: Is there a way to spare this line? > not sure what T is. you could try T(Ma); you can do that of course also > directly in the plot command T is a python function: def T(Ma): fp = fluidproperties.IdealGas() fp.Ma = Ma return NormalShock(fp).fp_out().T / fp. plot(Ma, T(Ma), label=r'$\frac{T2}{T1}$') does not work. The plot window appears, but no plot. > > plot(Ma, Ts, label=r'/frac{T2}{T1}') > should be backslash and math mode: > plot(Ma, Ts, label=r'$\frac{T2}{T1}$') > legend() > show() > > > and that's all, no plot window appears, the script is finished. > > you did not show() ! Actually I did it. I stripped the code before pasting it here, my fault. But not it works, thanks! Florian |
From: Eric F. <ef...@ha...> - 2010-01-29 20:14:19
|
Florian Lindner wrote: > Hello, > > I try to use LaTeX in my plot. I follow the instructions from http://www.scipy.org/Cookbook/Matplotlib/UsingTex > > florian@horus:~> cat .matplotlib/matplotlibrc > text.usetex : true > > My plotting code looks like: > > Ma = arange(1.0, 5.0, 0.01) > Ts = [T(i) for i in Ma] # BTW: Is there a way to spare this line? > plot(Ma, Ts, label=r'/frac{T2}{T1}') > > Running the script gives: > > python Stossverlauf.py --verbose-helpful > > $HOME=/home/florian > CONFIGDIR=/home/florian/.matplotlib > matplotlib data path /usr/lib64/python2.6/site-packages/matplotlib/mpl-data > loaded rc file /home/florian/.matplotlib/matplotlibrc > matplotlib version 0.99.1.1 > verbose.level helpful > interactive is False > units is False > platform is linux2 > Using fontManager instance from /home/florian/.matplotlib/fontList.cache > /usr/lib/python2.6/site-packages/pytz/tzinfo.py:5: DeprecationWarning: the sets module is deprecated > from sets import Set > backend Agg version v2.2 > > > and that's all, no plot window appears, the script is finished. If I remove the matplotlibrc everything works fine (of course no LaTeX). > I think all the necessary programs are in place: > > florian@horus:~> which latex > /usr/local/bin/latex > florian@horus:~> which dvipng > /usr/local/bin/dvipng > florian@horus:~> which gs > /usr/bin/gs > > Any idea what could be wrong? In addition to Sebastian's points, make sure your matplotlibrc is specifying an interactive backend (e.g. gtkagg, tkagg, wxagg, qt4agg) if you want the plot to appear on the screen. Eric > > Thanks, > > Florian > > ------------------------------------------------------------------------------ > The Planet: dedicated and managed hosting, cloud storage, colocation > Stay online with enterprise data centers and the best network in the business > Choose flexible plans and management services without long-term contracts > Personal 24x7 support from experience hosting pros just a phone call away. > http://p.sf.net/sfu/theplanet-com > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |