On 5 Jun 1996, Charlotte DeMott wrote:
> I would like to plot 4 images with axes overlaid per page using
> !P.MULTI = [0,2,2]. First I plot the axes so that the WINDOW
> variables are set. Then I plot the image using TV. Then I replot
> the axes, since the image overlaid the inward pointing tick marks.
>
> Here's the code:
>
> !p.position=[.2,.2,.761,.785]
> !P.MULTI=[0,2,2]
> FOR k=0,3 DO BEGIN
> ; make the axes first so the WINDOW variables are set
> PLOT, [0,355], [1,1], xrange=[0,355], yrange=[300,1], $
> TITLE='U200 (minus zonal and temporal mean)', $
> SUBTITLE='CSU95 control', $
> XTITLE='Longitude band (n to n+5)', $
> YTITLE='Day', $
> /XSTYLE, /YSTYLE
> print, !P.MULTI
>
> ; plot the image
> tv, a(k,*,*), !x.window(0), !y.window(0), $
> xsize=!x.window(1)-!x.window(0), $
> ysize=!y.window(1)-!y.window(0), /NORM
>
> ; Make axes again with inward pointing ticks OVERLAYING image
> PLOT, [0,355], [1,1], xrange=[0,355], yrange=[300,1], $
> /XSTYLE, /YSTYLE, /NOERASE
>
> ; end of file(0-3) loop
> END
>
> where a is byte array. the print statement yeilds the following output:
>
> 3 2 2 0 0
> 2 2 2 0 0
> 1 2 2 0 0
> 0 2 2 0 0
>
> Unfortunately, when viewing the postscript image in GhostView,
> I get four plots situated one on top of the other in the center
> of the page.
If you use !p.multi, you have to set !p.position and !p.region to 0
(viz. !p.position=0), otherwise !p.multi just doesn't work. You might
be able to achieve a suitable layout by using the XMARGIN and YMARGIN
settings in your plot call, and by using suitable X & Y offsets and sizes
(for the whole page) when you set up the PS device after you SET_PLOT,'ps'
(something of a black art :).
Also, you'll probably have some problems with the second plot call in your
loop (the one after the TV command), even though it uses the /NOERASE
keyword and doesn't appear to advance !p.multi(0). (It will probably
plot the axes in the "next" box, even though it shouldn't. I don't
understand exactly how !p.multi works - it seems a little quirky.)
The following short program may be of some help.
It sets the !.multi "box number" manually for each plot.
The program generates 4 plots labelled "1", "2", "3", "4", with a "dist"
image jammed in each box. The dist image for "1" is darkest, and "4" is
lightest. In hardcopy, the images will fill the plots exactly (they
won't on the screen).
pro plttest,hard=hard
hard=keyword_set(hard) ;use /HARD to generate PS hardcopy in ./idl.ps
a=sin(findgen(1024)/512.) &d=bytscl(dist(150,150)) ;junk test data
if hard then set_plot,'ps'
!p.position=0 &!p.region=0 ;make sure these are blanked out!
!p.multi=[0,2,2]
jj=[0,3,2,1] ;!p.multi box numbers
for i=0,3 do begin
!p.multi(0)=jj(i) ;set box # for first plot call
plot,a,/xs,/ys,titl=string(i+1),/nodata
tv,d*((i+4.)/7.),!x.window(0),!y.window(0),xsize=!x.window(1 )-!x.window(0),$
ysize=!y.window(1)-!y.window(0),/norm
!p.multi(0)=jj(i) ;set box # again!
plot,a,/xs,/ys,titl=string(i+1),/nodata,/noerase
endfor
if hard then begin
device,/close &set_plot,'x'
endif
return
end
Regards
Peter Mason
CSIRO division of Exploration and Mining
P.O Box 136, North Ryde, NSW, 2113, Australia
E-Mail: peter.mason@dem.csiro.au Tel: +61 2 887-8883 Fax: 887-8921/8909
|