Re: overlying an image and a contour plot [message #17871 is a reply to message #17849] |
Fri, 12 November 1999 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Sarah Tebbens (tebbens@my-deja.com) writes:
> We are trying to overlay an image and a contour
> plot, but can't get a perfect match in position
> and size.
>
> On the contour plot, the x axis is 652 values and
> the y axis is 5048 values. We want to fit the
> image exactly into the contour plot.
>
> The following commands are used:
>
> position=[.6,.05,r,.95]
> tv, image, .6, .05, $
> xsize=position(2)-position(0), $
> ysize=position(3)-position(1), /normal
> xvalue = 652.
> yvalue = 5048.
>
> ; r should be the length of the x-axis in the
> ; normal coordinate system (x and y window
> ; size=1)
> r= 10./7.*(.9 * xvalue/yvalue) + .6
>
> contour, xstyle=1, ystyle=1, /iso, $
> position=[.6,.05,r,.95], /noerase
>
> The image and contour overlay, but the x-axis of
> the image is too long to fit the contour plot.
> When the command tvimage is used instead of tv,
> the images are the same size, but are offset in
> both x and y direction by a few pixels.
>
> We think the problem is with the r value, but
> we don't know why the simple commands above
> don't work.
>
> Any suggestions to get these to overlay?
I think the problem probably lies in the use
of the ISOTROPIC keyword. I've never understood
what "isotropic" means, but I think it means
"keep the damn aspect ratio correct".
I would try something like this. (I would be
*very* surprised if this doesn't work, because
this is what TVIMAGE was designed for. If it
doesn't work, let me know immediately.)
windowPos = [0.1, 0.1, 0.9, 0.9]
TVImage, data, /Keep_Aspect, Position=windowPos
Contour, data, XStyle=1, YStyle=1, Position=windowPos, /NoErase
The key thing here is putting the window position in a variable,
since the actual values in it may change in the TVImage command.
In other words, the Position keyword is both an input and an
output keyword in this case.
Let us know. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|