comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: How to make this work? Oplot question.
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: How to make this work? Oplot question. [message #4845] Thu, 03 August 1995 00:00
korpela is currently offline  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>
Re: How to make this work? Oplot question. [message #4850 is a reply to message #4845] Wed, 02 August 1995 00:00 Go to previous message
rmmoss is currently offline  rmmoss
Messages: 12
Registered: August 1995
Junior Member
In article <1995Aug2.161654.29779@news.wrc.xerox.com>, jeyadev@kaveri (Surendar Jeyadev) writes:
|> I would greatly appreciate if someone can give me a hint on how to
|> accomplish the following task in PV Wave.
|>
|>
|> x = findgen(100)/10.0 x = findgen(100)/10.0
|> y = exp(-0.1*x)*sin(4*x)
|> plot, x, y ; plot decaying sin in !d.window=0
|>
|> wset, 1
|> y = exp(0.1*x)*cos(4*x)
|> plot, x, y ; plot rising cos in !d.window=1
|>
|> wset, 0
|> oplot, x, 0.1*x ; plot straight line in !d.window=0
|>
|> end
|>
|> So, the question is, can I accomplish what I would like to do in a
|> simple way. Or do I have to store the scaling information for window "0"
|> and set that each time I return to it? Unfortunately, the scale factors
|> are vastly different for the two windows.
|>
|> Thanks
|> --
|>
|> Surendar Jeyadev jeyadev@wrc.xerox.com

Yep, saving the plotting system variables is exactly what you do. Its not that
bad, however. The following simple-minded way will suffice.

x = findgen(100)/10.0
y = exp(-0.1*x)*sin(4*x)
plot, x, y

;save the settings
pstate0 = !P
xstate0 = !X
ystate0 = !Y
zstate0 = !Z

wset, 1
y = exp( 0.1*x)*cos(4*x)
plot, x, y

;save new settings
pstate1 = !P
xstate1 = !X
ystate1 = !Y
zstate1 = !Z

;now proceed to overplot at will :)

wset, 0

;restore old settings
!P = pstate0
!X = xstate0
!Y = ystate0
!Z = zstate0

oplot, x, 0.1*X

etc, etc. As usual, there are more complicated ways of doing this, but you
get the idea ;)

Robert M. Moss, Ph.D.
Texaco Inc.
rmmoss@texaco.com

This is not necessarily the opinion of Texaco Inc.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: How to make this work? Oplot question.
Next Topic: Re: WIDGET_OLH (online help) Help!

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:43:00 PDT 2025

Total time taken to generate the page: 0.00510 seconds