On Fri, Jan 9, 2009 at 10:09 AM, rmber <ryanmbergm...@gmail.com> wrote: > > Hi, I'm trying to reformat the ticks on the x axis of a plot I've made. I > need to divided the values by 1000 and then subtract 10, and I can't figure > out how. The hierarchy of ticker objects and tick instances is rather > confusing to me. Can anyone help?
A fairly easy way is to do:: locs = ax.get_xticks() labels = ['%1.2f'%(loc/1000. - 10.) for loc in locs] ax.set_xticklabels(labels) but this won't be updated when you pan and zoom. To do it right, use a tick formatter:: import matplotlib.ticker as ticker def format(x, pos=None): return '%1.2f'%(x/1000. - 10.) ax.xaxis.set_major_formatter(ticker.FuncFormatter(format)) JDH ------------------------------------------------------------------------------ Check out the new SourceForge.net Marketplace. It is the best place to buy or sell services for just about anything Open Source. http://p.sf.net/sfu/Xq1LFB _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users