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

Home » Public Forums » archive » Re: cGimage, Multiplot with /KEEP_ASPECT_RATIO
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: cGimage, Multiplot with /KEEP_ASPECT_RATIO [message #83280] Tue, 12 February 2013 09:12 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> That's a little convoluted. Just for the record, here is a better
> formulation that takes better advantage of cgAspect.
>
> ;----------------------------------------------------------- --
> img1 = cgDemoData(7)
> img2 = congrid(img1, 360, 180)
> cgDisplay, 900, 450
>
> pos = cgLayout([2,1], OYMargin=[4, 11], OXMargin=[5, 8], XGap=6)
> pos1 = pos[*,0]
> img1pos = cgAspect(Position=pos1, Aspect=img1, Align='top')
> cgImage, img1, CTIndex=3, /AXES, POSITION=img1pos, OPOSITION=op
> cgColorbar, CTIndex=3, /Fit
>
> pos2 = pos[*,1]
> ydiff = op[3] - pos2[3]
> pos2[3] = op[3]
> pos2[1] = pos2[1] + ydiff
>
> img2pos = cgAspect(Position=pos2, Aspect=img2, Align='top')
> cgImage, img2, /AXES, POSITION=img2pos, CTIndex=2, /NoErase
> cgColorbar, CTIndex=2, /Fit
> END
> ;----------------------------------------------------------- --

Now that I look at the code in the light of day, it is even simpler than
that! Try this.

;----------------------------------------------------------- --
img1 = cgDemoData(7)
img2 = congrid(img1, 360, 180)
cgDisplay, 900, 450

pos = cgLayout([2,1], OYMargin=[4, 11], OXMargin=[5, 8], XGap=6)
pos1 = pos[*,0]
img1pos = cgAspect(Position=pos1, Aspect=img1, Align='top')
cgImage, img1, CTIndex=3, /AXES, POSITION=img1pos, OPOSITION=op
cgColorbar, CTIndex=3, /Fit

pos2 = pos[*,1]
img2pos = cgAspect(Position=pos2, Aspect=img2, Align='top')
cgImage, img2, /AXES, POSITION=img2pos, CTIndex=2, /NoErase
cgColorbar, CTIndex=2, /Fit
END
;----------------------------------------------------------- --




--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: cGimage, Multiplot with /KEEP_ASPECT_RATIO
Next Topic: Re: XYOUTS in 3D

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

Current Time: Wed Oct 08 15:21:47 PDT 2025

Total time taken to generate the page: 0.00456 seconds