There is no way to insert newlines in the mathtext part of the string (by that I mean between the '$'). However, you can put newline characters outside of '$'. It gets a bit hairy because of Python's string escaping rules, but you could do something like:
"$\\alpha=%G$\n$\\beta=%G$" Note the double \\ where we really want a backslash, since we can't use "raw" string literals and write a newline character. One other caveat: The spacing of the lines doesn't take into account the height of the math expression, so you can really only do simple one-liners (i.e. no fractions or exponents) in the math expression. Your example looks like it will work though. This is really sort of "unsupported" and my example works only by accident... it's something I didn't think about while re-writing mathtext recently. Hopefully this can be improved in a future version -- I can see it as being generally useful. Also -- for others on the list: Is there a TeX or LaTeX standard for putting newlines in the middle of a math expression that perhaps we should support? All the Googling I've been able to do basically assumes that layout such as that would occur in a layer outside of the math expression (with the exception of typesetting things like matrices). Cheers, Mike BL wrote: > Hi, > > I want to display the values of some variable (namely, alpha, beta, > gamma, delta) on a plot, and making a legend like > "$ \alpha=%G, \ \bet=%G, \ \gamma=%G, \ \delta=%G $" % values is not > very readable. > Is there away to make multiline mathtext ? > > > thanks > > BL > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > > > ------------------------------------------------------------------------ > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users