[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: !p.multi and tv




davidf@dfanning.com (David Fanning) writes:
> ... [ discussion of how the PLOT command advances the !P.MULTI plot
>       position ] ...
> Here is the modified code, which shows plot titles clearly
> on my display. (Remember that outside margins are specified
> in character units, so your mileage may vary. Adjust as
> necessary.)
> 
> ****************************************************************
> PRO MultiImages, multi
> IF N_Params() NE 1 THEN multi = [0, 2, 2]
> imageFile = Filepath(SubDir=['examples','data'], 'worldelv.dat')
> print, imageFile
> image = BytArr(360, 360)
> OpenR, lun, imageFile, /Get_LUN
> ReadU, lun, image
> Free_Lun, lun
> Window, XSize=500, YSize=400
> !P.Multi = multi
> !X.OMargin = [2, 2]
> !Y.OMargin = [2, 2]
> FOR j=0, multi[1]*multi[2]-1 DO BEGIN
>     Plot, Findgen(11), Color=!P.Background
>     x1 = !X.Region[0] + 0.05
>     x2 = !X.Region[1] - 0.05
>     y1 = !Y.Region[0] + 0.05
>     y2 = !Y.Region[1] - 0.05
>     TVImage, image, Position=[x1, y1, x2, y2]
>     Plot, Findgen(11), position=[x1, y1, x2, y2], xticklen=-0.02, $
>       yticklen=-0.02, xtitle='latitude', ytitle='longitude', $
>       /nodata, /noerase
> ENDFOR
> END


You can also use the AXIS command to paste axes on top of the image.

     axis, xaxis=0, xtickformat='(A1)', xstyle=1
     axis, xaxis=1, xtickformat='(A1)', xstyle=1
     axis, yaxis=0, ytickformat='(A1)', ystyle=1
     axis, yaxis=1, ytickformat='(A1)', ystyle=1

This particular set of commands does not print the tick labels because
that part has been handled already by a preceding PLOT command.  Since
the plot has already been set up, the AXIS will automatically position
the axes correctly.

This is what I do in PLOTIMAGE, available from:
http://astrog.physics.wisc.edu/~craigm/idl/idl.html

Craig









-- 
--------------------------------------------------------------------------
Craig B. Markwardt, Ph.D.         EMAIL: craigmnet@astrog.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
--------------------------------------------------------------------------