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 #83282 is a reply to message #83281] Tue, 12 February 2013 08:31 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

>
> Fab writes:
>
>> Thanks, I adapted your idea in my code and after a few dozens of tries I
>> am satisfied with the output ;-) I won't change anything at the code
>> anymore though!
>
> Here is a programming challenge that will make this very much easier
> next time.
>
> Modify ASPECT (and feel free to rename the new program cgAspect) to
> accept an input position for which it can calculate a final position
> with the correct aspect ratio. This ought to be possible, since cgImage
> can apparently do this. ;-)

Alright, this was easy enough to do, so I just had Coyote do it. :-)

Find it here:

http://www.idlcoyote.com/programs/cgaspect.pro

And here is how I would use the routine to display these two images with
colorbars:

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

pos = cgLayout([2,1], OYMargin=[4, 11])
cgImage, img1, /KEEP_ASPECT_RATIO, CTIndex=3, $
/AXES, POSITION=pos[*,0], 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
;-------------------------------------------------


Cheers,

David

--
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 18:11:36 PDT 2025

Total time taken to generate the page: 0.00184 seconds