|
From: John H. <jd...@gm...> - 2007-04-10 21:13:50
|
On 4/10/07, Iyer <mas...@ya...> wrote:
> If only someone could guide me, so that I can
> understand better how to "translate" the ticks from
> the default "number of sample" ticks to that of
> different ticks - say
> new_ticks=original_ticks/(some_constant). Right now
> I'm clueless, your input will help a lot in
> understanding Mpl.
OK, your persistence is admirable. You are still asking the wrong
question and applying the wrong solution, but dog-golly, you've earned
the right to do it the wrong way!
from matplotlib.ticker import FuncFormatter
def myformatter(x, pos=None):
return '%1.3f'%(x/4.)
ax = subplot(111)
ax.plot(x, y)
ax.xaxis.set_major_formatter(FuncFormatter(myformatter))
Now all your ticks are magically divided by 4.
But really, simply scaling your x input data is the way to go. If we
want to move this conversation forward, you should try instead
plot(x/4, y)
and then explain as clearly as possibly this doesn't do what you want.
|