|
From: Friedrich R. <fri...@gm...> - 2010-04-19 19:28:25
|
2010/4/19 Friedrich Romstedt <fri...@gm...>: > http://matplotlib.sourceforge.net/api/ticker_api.html#matplotlib.ticker.FuncFormatter > For exponential ticks, I would propose (but it's untested): > >>>> def exp_fmt(loc): > exponent = numpy.round(numpy.log10(loc)) > return '$10^%d$' % exponent >>>> formatter = matplotlib.ticker.FuncFormatter(exp_fmt) >>>> # And so on. Well, as JJ pointed out recently, there is matplotlib.ticker.LogFormatterMathtext as a much better template to use ... Well, and even for scalar formatters, there is matplotlib.ticker.ScalarFormatter(useMathText = True) ... Shame on me! But it seems there is a small drawback: For non-rc-usetex mode, \mathdefault{} is used, making the math typeset in the normal, outside-math font (according to http://matplotlib.sourceforge.net/users/mathtext.html?highlight=mathdefault#fonts). What is the advantage of using matplotlib.ticker.ScalarFormatter(useMathText = True) then, when it's typeset in outside-math font anyway? Friedrich |