Re: tvimage followed by contour in ps... positioning not coming out right [message #45496] |
Tue, 13 September 2005 12:27 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Mike Newey writes:
> My question has to do with using tvimage from the programming library
> at www.dfanning.com. I am using it to plot an image in a postcript
> file and then I use contour - overplotting on top of that image. I am
> making multiple plots on one page so I have set the !P.multi variable.
> Simply put my code is (I can give the full code if necessary):
>
> set_plot, 'ps'
> DEVICE, FILENAME = pathname + 'VelContours.ps', /color,
> BITS=8,xsize=7,ysize=10,/inches,$
> ENCAPSULATED = 0, /portrait, XOFFSET = 1, YOFFSET = 1
> !P.Multi = [0,2,4]
>
> TVSCALE, image, /keep_aspect_ratio, position = get_position
> contour, arr, /noerase, position = get_position,c_colors = color, $
> level = levelset
>
> Well, as I understood it, this was supposed to overplot a contour
> exactly on top of my image. It does not do this, the contour instead
> plots with a different aspect ratio then the image, such that the two
> sides and bottom all mach up, but the contour is short of the top!
>
> I thought it might have something to do with this line in TVIMAGE:
>
> xsize = (position(2) - position(0)) * !D.X_VSIZE
> ysize = (position(3) - position(1)) * !D.Y_VSIZE
> xstart = position(0) * !D.X_VSIZE
> ystart = position(1) * !D.Y_VSIZE
>
> as the ratio that it was off was exactly (!D.Y_VSIZE/float(
> !D.X_VSIZE)). But that is only true for the first image that is
> plotted! After the first plot the ratio was different.. although I
> have not really looked into THAT much yet.
>
> This all seems very strange to me. Is tvimage supposed to work like I
> think it should, or am I using it wrong?
I think it is likely that if you set the XSTYLE=1 and YSTYLE=1
keywords on the CONTOUR command you will get what you expect.
If not, let me know.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|