Xaxis rescale

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?

-Ryan

···

--
View this message in context: http://www.nabble.com/Xaxis-rescale-tp21375188p21375188.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

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

···

On Fri, Jan 9, 2009 at 10:09 AM, rmber <ryanmbergmann@...287...> 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?