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

Reply via email to