[Thread Prev][Thread Next][Index]

Re: plot time series on same time axis



Another way is to create two identical windows:

def view/x=0,1/y=0,1 full	 ! this is actually already defined
def view/x=0,1/y=0,1 full2	 ! identical window

set vi full
plot/nolab/set/vlimits=v1:v2 t1  ! specify vlimits to be the same for both
ppl txlint,1,0			 ! label months only
ppl plot

set vi full2
plot/nolab/set/col=2/vlimits=v1:v2 t2	! specify the color or it will be black
ppl txlint,1,0
ppl plot

This technique works for a variety of purposes. An advantage of
doing it this way is that it is easy to make overlays where the
axes might be quite incompatible and you would like to retain
the original resolution.

For example, suppose you have a monthly time series tm and a
daily time series td:

set vi full
plot/nolab/set/sym=28 tm	! emphasize the monthly values with symbol
ppl txlint,1,0
ppl plot

set vi full2
plot/nolab/set/col=2 td		! daily values will be a smooth curve
ppl txlint,1,0
ppl plot

Billy K
------------------------------------------------------------------------
> How can I plot two time series with different time on same time axis?
> 
> For example, a variable t1 is defined on T=Jan-1900:Dec-1900, while
> another variable t2 on T=Jan-0020:Dec-0020. Year is no matter. I would
> like to compare monthly variations of these two time series.
> Now I want to plot t1 and t2 on same time axis. How can I do this?
------------------------------------------------------------------
> 	You need to regrid one of the variables onto the time axis of
> the other.  Suppose v1900 has 12 monthly values from the year 1900
> and v0020 has 12 values from the year 0020.  Then
>         plot/set v1900,v0020[g=g1900,gt=@asn]
> 	ppl txlint,1,0 ; ppl plot
> should do the plotting and drop the year label on the time axis.
> Example:
>    def axis/t=15-jan-1900:15-dec-1900/npoints=12 t1900
>    def grid/t=t1900 g1900 ; let v1900=randu(t[g=g1900])
>    def axis/t=15-jan-0020:15-dec-0020/npoints=12 t0020
>    def grid/t=t1900 g0020 ; let v0020=randn(t[g=g0020])
>    plot/nolab/set v1900,v0020[g=g1900,gt=@asn]
>    ppl txlint,1,0 ; ppl plot


[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement