View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

accessing displayed plot range in scripts?

Roberto Abraham at IoA, Cambridge wrote on Aug 05, 1998

Hi - I suspect this is a trivial question, but searching through the IRAF
docs I've been unable to find out how to determine (within a CL script or
SPP program)  the current plot limits (in world coordinates) of a
displayed plot.  The reason I'd like to be able to do this is because I've
written a little script that labels generic spectral features (using IGI
to superpose labels on a displayed spectrum), but plotting labels is
rather slow, and currently my script is spending a lot of time drawing
labels off-screen. But if I can have the script limit itself to only draw
labels within the displayed wavelength range it would really speed it up.

Thanks,

Bob

---------------------------------------------------------------------------
Roberto Abraham            |  E-mail: abraham@ast.cam.ac.uk
Institute of Astronomy     |  Tel (direct)    +44-(0)-1223-374970 
Cambridge University       |      (secretary) +44-(0)-1223-337548
Madingley Road, Cambridge  |  FAX             +44-(0)-1223-337523
CB3 OHA  United Kingdom    |  Mobile                  0467-371014
--------------------------------------------------------------------------
"What gets us into trouble is not what we don't know.
 It's what we know for sure that just ain't so."
 - Yogi Berra
--------------------------------------------------------------------------

Mike Fitzpatrick wrote on Aug 05, 1998

> I suspect this is a trivial question, but searching through the IRAF
> docs I've been unable to find out how to determine (within a CL script or
> SPP program)  the current plot limits (in world coordinates) of a
> displayed plot.

	The answer may best depend on what's drawing the plot in the first
places, e.g. if you use GRAPH or IGI to draw the plot your script can
already know the limits since these are set as task parameters or part of
the igi file.  Otherwise, the only way to get the limits from a CL script
is to dump (or redirect) the graphics metacode to a file and then parse
the output of GKIDECODE with the verbose option turned on.  What you're
looking for is a line something like

set_wcs nwords=352
	 1 1. 256. 45. 1941.  0.11 0.89 0.15 0.88  0 0 7
	   ^^^^^^^^^^^^^^^^^
The indicated items  the plot (x1,x2,y1,y2).  From an SPP program you
would have to open a graphics pointer in APPEND mode and then make a call
to ggwind(), e.g.

        gp = gopen ("stdgraph", APPEND, STDGRAPH)
        call ggwind (gp, x1, x2, y1, y2)

The simplest may be to use such an SPP program to get the WCS and print it
out so the script can scan them into local variables, I assume there are
other reasons for not having IGI draw the whole plot itself.
	Hope this helps.

Cheers,
-Mike

Last post on Aug 05, 1998