1-10^-1 Custom Log Ticker

Hi,

As the subject shows, I am trying to create a custom ticker (class??) that
has pretty formatted log tick.

Instead of just 10^-5, 10^-5, etc, is something more like
[1-10^-2, 1-10^-3, 1-10^-4] etc

I am histogram'n a set of data that is very close to 1, basically ranging
from 0.990 and 0.9922, but mostly being centered on 0.9921. I would love to
see meaningful labels.

Any ideas?

···

--
View this message in context: http://old.nabble.com/1-10^-1-Custom-Log-Ticker-tp32414832p32414832.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

import matplotlib.ticker as tick
def showOnlySomeTicks(x, pos):
     s = str(int(x))
     if x == 5000:
         return '5e3'#'%.0e' % x
     return ''
ax = plt.axes([0.165,0.2,0.95-0.24,0.95-0.2])
ax.xaxis.set_minor_formatter(tick.FuncFormatter(showOnlySomeTicks))

Then in the code something just change xaxis to yaxis or vice versa. Can also set the major formatter like this. Not sure if this is what you were looking for but it seems you want custom tick labels. Can also set the location of the ticks and check ticker page below for more info.

For setting a different base check the multiplelocater from the ticker class here:
http://matplotlib.sourceforge.net/api/ticker_api.html

···

On 09/07/2011 08:03 PM, shaunh1 wrote:

Hi,

As the subject shows, I am trying to create a custom ticker (class??) that
has pretty formatted log tick.

Instead of just 10^-5, 10^-5, etc, is something more like
[1-10^-2, 1-10^-3, 1-10^-4] etc

I am histogram'n a set of data that is very close to 1, basically ranging
from 0.990 and 0.9922, but mostly being centered on 0.9921. I would love to
see meaningful labels.

Any ideas?