nicely formatted exponential in title

I tried:

plt.title (r'$\omega=%s$' % omega), where omega=-1e-5. The title says:

omega=-1e-05

with the 'e' in italics, and the whole thing generally ugly.

What I'd like to see is what TeX would do for $1 \times 10^{5}$.

I know mpl already can nicely format numbers for axis. Can I somehow use that
mechanism to nicely format numbers in my title (or other places)?

Have you tried latex_float() as suggested here ?
http://stackoverflow.com/questions/13490292/format-number-using-latex-notation-in-python

def latex_float(f):
     float_str = "{0:.2g}".format(f)
     if "e" in float_str:
         base, exponent = float_str.split("e")
         return r"{0} \times 10^{{{1}}}".format(base, int(exponent))
     else:
         return float_str

title (r'$\omega=%s$' % latex_float(omega))

···

Am 20.11.2013 19:00, schrieb Neal Becker:

I tried:

plt.title (r'$\omega=%s$' % omega), where omega=-1e-5. The title says:

omega=-1e-05

with the 'e' in italics, and the whole thing generally ugly.

What I'd like to see is what TeX would do for $1 \times 10^{5}$.

I know mpl already can nicely format numbers for axis. Can I somehow use that
mechanism to nicely format numbers in my title (or other places)?

------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing
conversations that shape the rapidly evolving mobile landscape. Sign up now.
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users