Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.
Close
From: John Pye <john.pye@st...>  20060616 06:22:35

Hi all I came across this page: http://www.scipy.org/Cookbook/Matplotlib/UsingTex which mentions using LaTeX to generate labels on plots in Matplotlib. What I only discovered recently is that you don't need this 'usetext=1' thing in order to create captions on plots that include subscripts, etc. According to section 2.6.4 of the user's guide, you can just surround your text with $...$ to have it formatted as if it were latex. This is especially important if you're exporting SVG graphics (eg if you want to add more captioning/labelling using inkscape): the 'usetex' approach fails in that case. I wonder if someone with write access to the scipy wiki could maybe update the above page with some comments about the 'mathtext' support in Matplotlib? It might also be worth noting that the mathtext functionality doesn't support the \frac operator. Cheers JP  John Pye School of Mechanical and Manufacturing Engineering The University of New South Wales Sydney NSW 2052 Australia t +61 2 9385 5127 f +61 2 9663 1222 mailto:john.pye_AT_student_DOT_unsw.edu.au http://pye.dyndns.org/ 
From: Wolfgang <wollez@gm...>  20060616 09:28:44

Hi, frac works for me: yaxislabel=r'\sffamily water content $\left( \frac{\textsf{kg}}{\textsf{m}^{\textsf{\small 2}}}\right) $' ylabel(yaxislabel) And you can also set rc('text', usetex=False) in your file to enable or disable tex in my case I did the following: tex_out=True # False if tex_out: xaxislabel=r'time ($\sqrt{\textsf{s}}$)' yaxislabel=r'\sffamily water content $\left( \frac{\textsf{kg}}{\textsf{m}^{\textsf{\small 2}}}\right) $' rc('text', usetex=True) else: xaxislabel='time (s**0.5)' yaxislabel='water content (kg/m2)' rc('text', usetex=False) It's perhaps not the mose elegant way to do, but I'm quite new to python/pylab/matplotlib Wolfgang John Pye schrieb: > Hi all > > I came across this page: http://www.scipy.org/Cookbook/Matplotlib/UsingTex > which mentions using LaTeX to generate labels on plots in Matplotlib. > > What I only discovered recently is that you don't need this 'usetext=1' > thing in order to create captions on plots that include subscripts, etc. > According to section 2.6.4 of the user's guide, you can just surround > your text with $...$ to have it formatted as if it were latex. This is > especially important if you're exporting SVG graphics (eg if you want to > add more captioning/labelling using inkscape): the 'usetex' approach > fails in that case. > > I wonder if someone with write access to the scipy wiki could maybe > update the above page with some comments about the 'mathtext' support in > Matplotlib? It might also be worth noting that the mathtext > functionality doesn't support the \frac operator. > > Cheers > JP > 
From: John Pye <john.pye@st...>  20060616 10:34:14

What I meant to say was that \frac doesn't work for me with the mathtext renderer, i.e. with usetex=False. Do you find that it *does*? Cheers JP Wolfgang wrote: >Hi, > >frac works for me: > >yaxislabel=r'\sffamily water content $\left( >\frac{\textsf{kg}}{\textsf{m}^{\textsf{\small 2}}}\right) $' > >ylabel(yaxislabel) > > >And you can also set >rc('text', usetex=False) >in your file to enable or disable tex > >in my case I did the following: > >tex_out=True # False >if tex_out: > xaxislabel=r'time ($\sqrt{\textsf{s}}$)' > yaxislabel=r'\sffamily water content $\left( >\frac{\textsf{kg}}{\textsf{m}^{\textsf{\small 2}}}\right) $' > rc('text', usetex=True) >else: > xaxislabel='time (s**0.5)' > yaxislabel='water content (kg/m2)' > rc('text', usetex=False) > >It's perhaps not the mose elegant way to do, but I'm quite new to >python/pylab/matplotlib > > >Wolfgang > >John Pye schrieb: > > >>Hi all >> >>I came across this page: http://www.scipy.org/Cookbook/Matplotlib/UsingTex >>which mentions using LaTeX to generate labels on plots in Matplotlib. >> >>What I only discovered recently is that you don't need this 'usetext=1' >>thing in order to create captions on plots that include subscripts, etc. >>According to section 2.6.4 of the user's guide, you can just surround >>your text with $...$ to have it formatted as if it were latex. This is >>especially important if you're exporting SVG graphics (eg if you want to >>add more captioning/labelling using inkscape): the 'usetex' approach >>fails in that case. >> >>I wonder if someone with write access to the scipy wiki could maybe >>update the above page with some comments about the 'mathtext' support in >>Matplotlib? It might also be worth noting that the mathtext >>functionality doesn't support the \frac operator. >> >>Cheers >>JP >> >> >> > > > >_______________________________________________ >Matplotlibusers mailing list >Matplotlibusers@... >https://lists.sourceforge.net/lists/listinfo/matplotlibusers > > > 
From: John Hunter <jdhunter@ac...>  20060616 13:28:56

>>>>> "John" == John Pye <john.pye@...> writes: John> I wonder if someone with write access to the scipy wiki John> could maybe update the above page with some comments about John> the 'mathtext' support in Matplotlib? It might also be worth John> noting that the mathtext functionality doesn't support the John> \frac operator. As far as I know, anyone can get write access to the scipy wiki simply by registering. 