Re: Plotting Axes Over Image. [message #15582] |
Mon, 31 May 1999 00:00 |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Stephen Plumb (plumb@piffleph.und.ac.za) writes:
> I have an image displayed in a window (say window1) and I would like to
> calibrate it by inserting some sort of x and y axes.
> The problem is that the axes are offset from the window edges. Ideally I
> would like the x Axis to go straight through the centre of the image (ie y=
> 768/2), from left edge to right edge, and the y axix to go anywhere as long
> as it spans the full height of the image. Does anyone have any ideas?
I would try something like this:
s = Size(image, /Dimensions)
pos = [0.10, 0.10, 0.95, 0.95]
TVImage, image, Position=pos, /Erase, /Keep_Aspect
Plot, [0, s[1]], [0,s[0]], XStyle=5, YStyle=9, $
YTickS=8, Position=pos, /NoErase, /NoData
Axis, /XAxis, 0, !Y.CRange[1]/2.0, XStyle=1, XTicks=4
You can download the TVImage program from my web page.
It is a replacement for TV. Or, you can download TVScale
if you prefer the TVSCL command (although I don't generally
recommend it unless you understand what you are doing).
But the nice thing about either of these programs is that
the image can be positioned in the window with the
POSITION keyword.
http://www.dfanning.com/programs/tvimage.pro
Note that the code above works with any size image and
in any size window. :-)
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
|
|
|