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

Home » Public Forums » archive » !p.multi and tv
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: !p.multi and tv [message #11872 is a reply to message #11753] Wed, 27 May 1998 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Cathy (csaute3@alumni.umbc.edu) writes in response to some
code I hacked up for her:

> This works well. In addition to the image, I would like to add axes, etc.
> so I did this loop:
>
> FOR j=0, multi[1]*multi[2]-1 DO BEGIN
> ; establish the size of the plot window
> 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
>
> However the xtitle is "cut off" for image(s) along the bottom of the window,
> and ytitle is "cut off" for image(s) along the left of the window.
> Is there a way to "make them visible"?

The problem is that by positioning the axes in the plot "window"
I didn't leave enough room for the titles. Hence, they got
clipped. I prefer to work with the plot POSITION, rather than the
plot REGION (which includes the space allocated for titles and other
plot annotation), because it makes it much easier to do things
like puts axes around images, etc.

This code could probably be fixed just by making the "margin"
around each plot larger. Say 0.1 rather than 0.05. Or, alternatively,
I could set the "outside" margins of the plot larger with the
!X.OMargin and !Y.OMargin keywords, which is what I choose to
do in the modified code below.

> Also, if I left the position keyword out of the second plot command,
> the plot appeared in the quadrant next to the tvimage (not overlay).
> Why?

The PLOT command is what "advances" the !P.MULTI system
variable to the next plot. My original code had a single
PLOT command that drew each plot in the background color
before each TVImage call. The purpose of this is to set
the system variables manipulated by !P.MULTI to the next
plot. I had to do this because TV commands don't "advance"
anything, just like they don't erase the display before
they draw into it.

Normally, the second PLOT command in your code would
advance the plot. Using the POSITION keyword obviously
causes !P.MULTI to think seriously about what it is doing.
I'm frankly surprised it made such a smart decision in
this case. I would have expected all kinds of bad things
to happen with the code above. But then again, that's why
I love IDL! :-)

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
************************************************************ ***********

Cheers,

David

-----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438
Coyote's Guide to IDL Programming: http://www.dfanning.com/
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: PostScript and IDL, why object graphics ?
Next Topic: PostScript and IDL,

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

Current Time: Sat Oct 11 19:20:21 PDT 2025

Total time taken to generate the page: 0.56011 seconds