| Re: Display widgets' scaling factors [message #12804 is a reply to message #12803] |
Wed, 09 September 1998 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
TJ Saunders (tjs@u.washington.edu) writes:
> Something that often crops in up my widget programming is the difficulty I
> have in trying to have two child draw widgets under one parent, each with
> different xy ranges, scaling, that sort of thing. Ideally, I would like
> to be able to draw in each widget with the correct scaling factors. But,
> I have found that the scale factors for the last plot drawn remain in
> effect, even if WSET is used. I have tried to manually change the !P, !X,
> !Y, and !Z system variables for each display, but that doesn't seem to
> work. I'm sure that there is a solution somewhere...any ideas?
Oh, I'm working on my web page this morning and I was looking for
good ideas for tips. :-)
You write "even if WSET is used". Believe me, in a widget
program WSET *must* be used! But I don't want to get into
*that*. :-)
You are correct that WSET has absolutely no bearing on
the plot scale factors in the window. It's one and only
purpose is to allow you to select the current graphics
window (I.e., the window that very next graphic command
will be sent to).
Data scaling parameters are set in the system variables.
If you keep track of these for each window, then you
will have no trouble getting things to work properly. The
fact that you *are* having trouble, even when you try
setting them suggests you are not doing it properly.
The proper thing would be to draw into the first window
and *immediately* save the system variables.
WSet, window1
Plot, data
p1 = !P
x1 = !X
y1 = !Y
z1 = !Z
Then, do the same thing for the other window:
WSet, window2
Plot, moredata
p2 = !P
x2 = !X
y2 = !Y
z2 = !Z
When you want to go back to the first window (perhaps to
overplot on the plot that is already there), you simply
restore the proper system variables before overplotting:
WSet, window1
!P = p1
!X = x1
!Y = y1
!Z = z1
OPlot, stillmoredata
Of course, in a widget program these values will have to
be saved in the info structure so you can access them.
If I have time later today I'll write this idea up more
formally and put an example on my web page.
Cheers,
David
----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438, Toll-Free Book Orders: 1-888-461-0155
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
|