Re: How to make this work? Oplot question. [message #4845] |
Thu, 03 August 1995 00:00  |
korpela
Messages: 59 Registered: September 1993
|
Member |
|
|
In article <1995Aug2.161654.29779@news.wrc.xerox.com>,
Surendar Jeyadev <jeyadev@kaveri> wrote:
> I would greatly appreciate if someone can give me a hint on how to
> accomplish the following task in PV Wave.
I wrote a little routine to do what you want. (I use IDL, so it may not
be perfect in PV Wave, but it should work) As long as you use less than 10
windows, it should work without modification.
>
> x = findgen(100)/10.0
> y = exp(-0.1*x)*sin(4*x)
> plot, x, y ; plot decaying sin in !d.window=0
savestate
>
> wset, 1
> y = exp(0.1*x)*cos(4*x)
> plot, x, y ; plot rising cos in !d.window=1
savestate
>
> wset, 0
restorestate
> oplot, x, 0.1*x ; plot straight line in !d.window=0
>
> end
Here are the routines
------------------------------------------------------------ -----------------
pro savestate
common savestates,pstate,xstate,ystate,zstate,setpstate
if not(keyword_set(setpstate)) then begin
pstate=replicate(!p,10)
xstate=replicate(!x,10)
ystate=replicate(!y,10)
zstate=replicate(!z,10)
setpstate=1
endif
n=!d.window
pstate(n)=!p
xstate(n)=!x
ystate(n)=!y
zstate(n)=!z
end
------------------------------------------------------------ ------------------
pro restorestate
common savestates,pstate,xstate,ystate,zstate,setpstate
if not(keyword_set(setpstate)) then begin
pstate=replicate(!p,10)
xstate=replicate(!x,10)
ystate=replicate(!y,10)
zstate=replicate(!z,10)
setpstate=1
endif
n=!d.window
!p=pstate(n)
!x=xstate(n)
!y=ystate(n)
!z=zstate(n)
end
------------------------------------------------------------ ------------------
--
Eric Korpela | An object at rest can never be
korpela@ssl.berkeley.edu | stopped.
<a href=" http://www.cs.indiana.edu/finger/mofo.ssl.berkeley.edu/korpe la/w">Click here for more info.</a>
|
|
|