IRAF paso a paso: 5 - Graphics tools

The graphic cursor

As an example, we may use implot dev$pix, get help on task's and global cursor commands, do a few operations, than quit. Typing =gcur we are back in the graphic window.

Printing/saving graphic output

  1. The most straightforward way to print out a graph is to set the device variable to lpr or lw4 or any other printer known to IRAF. Ex:
    cl> implot dev$pix 256 dev=lpr ; gflush
    Normally cl> gflush is required to actually start the printing operation.
  2. Alternatively, the graph can be saved on a postscript file, ex.:
    cl> implot dev$pix 256 dev=psi_land ; gflush
    The graph is save on a postscript file in the current directory (or in directory /tmp) in landscape format. After gflush IRAF should show the file name, or just look in the directory for a new "pskXXXZX.eps" file. Rename/move the file to an appropriate place.
    Useful if you want to check out the output before printing (ex. with ghostview).
    Notice that cl> gflush erases the graphic buffer (You lose the plot from the memory).
  3. There is also the possibility to save/print the graph interactively, by doing, in interactive cursor mode:
    :.snap [device] and then :.gflush, where device might be lpr or psi_land, for instance. (If you do not specify the device, the value of variable stdplot is used).
  4. A (longish) list of all availabe devices can be obtained by examining the file: dev$graphcap.

Graphics on the display window

Sometimes it is useful to redirect the output on the display window.
For instance, you overlay the isophotes of a galaxy from a broad-band image on the narrow-band image; or you overlay a coordinate grid.

Example 1: Overplot coordinate grid (also task wcslab can be used)
cl> disconlab dev$wpix disp+ cont- label+ left=0.1 right=0.9 bot=0.1 top=0.9

Example 2: Overplot HST apertures (also task siaper could be used)
cl> disconlab dev$wpix disp+ cont- label- doaper+ ra=13:27:45 dec=47:27:00 \
roll=0 left=0.1 right=0.9 bot=0.1 top=0.9

Example 3: Mark on the image display stars listed in a file (ex. output from DAOFIND):
cl> tvmark 1 devpix.coo mark=circle radii=5 numb+

Note that sometimes the overplot may be bad, for instance the contours may apear offset with respect to the displayed image. There could be many reasons for this, for instance some parameters in disconlab as well as in the tasks called by it (wcslab, newcont, display) may not be set correctly, or the header of the image is not standard and IRAF gets confused and misinterprets the coordinate system.

Redirection of graphic output to image window can be done by setting device=imdX, with X=w/r/g/b/y: w=white, r=red, g=green, b=blue, y=yellow.
Ex. device=imdg overplot on image display in green.
It is not recommended to use this redirection with general graphics tasks, as it is not fully supported (and probably there is no point to do that). It's better to use only the specialized tasks for this purpose.

Image cursor from graphic window

It is possible to force tasks that normally interact with the image display to use the graphics window instead. This is done by setting:
cl> set stdimcur = stdgraph
which means: the interactive image cursor now operates on the graphics window.

Example: a user has done a contour plot of a image
cl> newcont dev$pix floor=40 ceiling=1000 ncont=10 per+ pres+
After setting stdimcur as said above, he can then use imexamine to do some statistics on the image.
cl> imexam (use keystroke "m")
Though, if he uses an imexamine's keystroke which produces a graphic output, he loses the contour plot (I do not know if there are workarounds).

I have no particular examples where this trick might be useful (I never used it).

The sgraph task

The sgraph task provides a general purpose plotting capability, as it can be used to plot from lists, images and tables. We can control the characteristics of the graphic output via three psets: devpar, pltpar, axispar; parameters from these sets can also be placed on the command line.

Be careful with the dvpar.append parameter. It can be set to "yes" if you want to overplot new data over existing ones, but then do not forget to set it to "no" when you want to make a fresh new plot.

Metacode files

As an example, I mention a couple of situations where I found it useful:
1) Fit non-interactively gaussian profiles to spectral lines (ex. task fitprofs). The overplot of the fitted profile on the datapoints can be saved in a metacode file and examined later.
2) imexamine is used to plot the radial profile of a list of objects. The profiles can be saved in a metacode file using the >G redirection option.