|
From: Iyer <mas...@ya...> - 2007-04-10 15:06:59
|
I apologize if I haven't been sufficiently clear.
While your suggestion picks out the samples from the
sample set, and discards other samples - what I was
looking at --
when I plot a sample set, of say - 1000 points, the
xticks shows up as 0 to 1000 points on the plot.
I was wondering if there could be a way to translate
the xtick display to that of seconds, if the sampling
frequency is 250 Hz, the plot would still display the
original data set, but with different xticks -- for
e.g. it would display xticks as 0 to 4 seconds rather
than 0 to 1000 points.. hence is there a good way to
"translate ticks" ?
-iyer
--- John Hunter <jd...@gm...> wrote:
> On 4/10/07, Iyer <mas...@ya...> wrote:
> > I'd like to avoid the pylab interface...
> > linspace is good.
>
> from matplotlib.mlab import linspace
>
> But linspace may not be what you want. Probably
> better:
>
> In [1]: Fs = 4. # sampling at 4Hz
>
> In [2]: dt = 1./Fs
>
> In [3]: import numpy
>
> In [4]: ind = numpy.arange(1000.) # the sample
> number
>
> In [5]: t = ind*dt # the sample times
>
> In [6]: t[0]
> Out[6]: 0.0
>
> In [7]: t[1]
> Out[7]: 0.25
>
>
> linspace gives a slightly different answer, because
> it includes the
> endpoint. Sometimes this is what you want,
> sometimes not.
>
____________________________________________________________________________________
The fish are biting.
Get more visitors on your site using Yahoo! Search Marketing.
http://searchmarketing.yahoo.com/arp/sponsoredsearch_v2.php
|