Re: [Matplotlib-users] latex labels on plots
> "John" == John Pye <[EMAIL PROTECTED]> 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. ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] latex labels on plots
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 >> >> >> > > > >___ >Matplotlib-users mailing list >Matplotlib-users@lists.sourceforge.net >https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] latex labels on plots
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 > ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] latex labels on plots
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/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users