Re: multi window switching [message #8464 is a reply to message #8462] |
Fri, 14 March 1997 00:00   |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Daniel Williams writes:
> I would like to open a number of plots with the !p.multi keyword, and
> then place data points on each plot. Sounds simple, but then I would
> like to add more data to each plot as time goes by.
>
> The trouble is, I do not know how to tell IDL "go back to the first
> (or nth) plot, and overplot there". This is such a trivial-seeming
> task, can it be done?
Of course it can be done, Daniel. This is IDL we are talking about! :-)
The reason !P.MULTI is used to set up multiple plots on a page
is that it relieves the user of a lot of bookkeeping about
where to place the plot axes, how big to make the plot characters,
etc. In fact, !P.MULTI sets a lot of fields in the !P, !X, and !Y
system variables to do its job.
If you wish to overplot data on a plot other than the last one
that has been created with !P.MULTI then you have to know
how to restore these !P.MULTI-manipulated fields to their original
values when the plot was created. In practice this means saving the
!P, !X and !Y system variables after every plot, so they can be
restored for the plot of interest.
Here is an example for three plots, in which I overplot new data
on the second plot after drawing all three originally. The method
applies to any one of the three original plots.
Window, XSize=600, YSize=300
!P.MULTI = [0, 3, 1]
; Draw the first plot. Keep info.
PLOT, Findgen(11)
p1 = !P & x1 = !X & y1 = !Y
; Draw the second plot. Keep info.
PLOT, Findgen(11)
p2 = !P & x2 = !X & y2 = !Y
; Draw the third plot. Keep info.
PLOT, Findgen(11)
p3 = !P & x3 = !X & y3 = !Y
; Restore Plot2 info and overplot on the second plot.
!P = p2 & !X = x2 & !Y = y2
OPLOT, Reverse(Findgen(11))
Overplotting on any of the three plots is now just a matter
of restoring the appropriate system variables.
Cheers!
David
-----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
2642 Bradbury Court, Fort Collins, CO 80521
Phone: 970-221-0438 Fax: 970-221-4762
E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com
-----------------------------------------------------------
|
|
|