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

Home » Public Forums » archive » Re: How do I plot two images with !P.Multi, while keep the aspect ration reflecting the image size
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: How do I plot two images with !P.Multi, while keep the aspect ration reflecting the image size [message #72182] Wed, 18 August 2010 02:22 Go to next message
Ding is currently offline  Ding
Messages: 20
Registered: March 2008
Junior Member
Thanks, it is very helpful, I was not aware of this procedure.



On Aug 17, 6:56 pm, Chris <beaum...@hawaii.edu> wrote:
> Use David's TVIMAGE program and skip !p.multi
>
> tvimage, bytscl(im1), pos=[.05, .05, .45, .95], /keep
> tvimage, bytscl(im2), pos=[.5, .05, .95, .95], /keep
>
> http://www.dfanning.com/programs/tvimage.pro
>
> chris
>
> On 8/16/10 11:50 PM, Ding wrote:
>
>> Hello Eveyone,
>
>> I attempted to plot two images
>> img1=fltarr(512,512)
>> img2=fltarr(108,128)
>
>> How do I plot them for (EPS output) in a layout of !
>> P.Multi=[0,2,1,0,0]. plot them with the same height while keeping the
>> aspect ratio to reflect their real size, as img2 is part of img1 and
>> scaled to illustrate the details.
>
>> Thanks
>
>
Re: How do I plot two images with !P.Multi, while keep the aspect ration reflecting the image size [message #72185 is a reply to message #72182] Tue, 17 August 2010 10:56 Go to previous messageGo to next message
Chris[7] is currently offline  Chris[7]
Messages: 4
Registered: August 2010
Junior Member
Use David's TVIMAGE program and skip !p.multi

tvimage, bytscl(im1), pos=[.05, .05, .45, .95], /keep
tvimage, bytscl(im2), pos=[.5, .05, .95, .95], /keep

http://www.dfanning.com/programs/tvimage.pro

chris



On 8/16/10 11:50 PM, Ding wrote:
> Hello Eveyone,
>
> I attempted to plot two images
> img1=fltarr(512,512)
> img2=fltarr(108,128)
>
> How do I plot them for (EPS output) in a layout of !
> P.Multi=[0,2,1,0,0]. plot them with the same height while keeping the
> aspect ratio to reflect their real size, as img2 is part of img1 and
> scaled to illustrate the details.
>
> Thanks
Re: How do I plot two images with !P.Multi, while keep the aspect ration reflecting the image size [message #72259 is a reply to message #72182] Thu, 19 August 2010 09:33 Go to previous message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
Hi all,

I took a stab at doing this in IDL 8.0 with the new graphics:

READ_JPEG, FILEPATH('elev_t.jpg', SUBDIR=['examples','data']), data

x1 = 100 & w = 108
y1 = 100 & h = 128

width = 0.4
pos1 = [0.1, 0.1, 0.1 + width, 0.8]
aspect = float(w)/h
pos2 = pos1
pos2[0] = 0.6
pos2[2] = pos[0] + width*aspect

im1 = IMAGE(data, AXIS_STYLE=1, POSITION=pos1)
im2 = IMAGE(data, /CURRENT, POSITION=pos2, $
XRANGE=[x1,x1+w], YRANGE=[y1,y1+h])


; Add a fancy box and lines showing the "subset" area
rect = POLYGON([x1,x1+w,x1+w,x1],[y1,y1,y1+h,y1+h], /DATA, $
COLOR='red', FILL_BACKGROUND=0, TARGET=im1)
pt1 = im1.ConvertCoord(x1+w,y1+h, /DATA, /TO_NORMAL)
pt2 = im2.ConvertCoord(x1,y1+h, /DATA, /TO_NORMAL)
p = POLYLINE([pt1[0],pt2[0]],[pt1[1],pt2[1]], COLOR='red')
pt1 = im1.ConvertCoord(x1+w,y1, /DATA, /TO_NORMAL)
pt2 = im2.ConvertCoord(x1,y1, /DATA, /TO_NORMAL)
p = POLYLINE([pt1[0],pt2[0]],[pt1[1],pt2[1]], COLOR='red')

; Save the entire window to a PDF file
im1.Save, 'output.pdf'

Sorry it's a bit long. I got all fancy with the boxes and lines. But
it looks nice.

-Chris
ITTVIS
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: IDL syntax highlighting in other documents
Next Topic: Re: IDL syntax highlighting in other documents

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

Current Time: Wed Oct 08 11:32:52 PDT 2025

Total time taken to generate the page: 0.00745 seconds