|
From: Iyer <mas...@ya...> - 2007-05-15 00:48:31
|
Hi
I apologize for my late response, I was in the
hospital.
Thanks for the tip, the ticks are now magically
divided by a constant.
Here's some input on scaling the input data:
Say -- you have 25000 points of data. You want to
capture each and every point of data on a plot. Mpl
lists the ticks as a function of the number of data
points, which is cool. Now comes a situation where in
you want to manipulate the ticks to display - say the
time, for eg., the 100th data point came in at 1 sec,
the 200th came in at 2 sec, and so on - Is scaling the
input data the way to go ?
-iyer
--- John Hunter <jd...@gm...> wrote:
> 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.
>
____________________________________________________________________________________Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games.
http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow
|