4 GRAPHICS


Plot using an approved graphics package !!! 63
All graphics operations must be carried out, ultimately, by the GKS (SUN/83) and IDI (SUN/65) libraries.

GKS:   Direct use of raw GKS in applications is discouraged, in favour of using one of the Starlink-supported higher-level packages as an intermediary. These include SGS, the NCAR utilities (and the SNX routines), the NAG Graphical Supplement, and PGPLOT. (Though the Starlink version of the proprietary package MONGO uses GKS, use of callable MONGO in application programs is not encouraged in this standard as its functions are provided elsewhere. MONGO is supplied by Starlink principally for interactive use, and is in any case being phased out in favour of the Starlink PGPLOT-based PONGO package.)

SGS:   Where only low-level facilities are required (lines, character strings, formatted numbers, simple shapes, but not complete axes or whole graphs) the SGS package (SUN/85) is recommended. SGS consists mainly of convenient packaging of GKS functions, including easy control of plotting zone and a flexible workstation naming scheme, and can be used in conjunction with direct GKS calls.

PGPLOT:   In standalone applications where complete graphs are to be drawn and convenience is more important than flexibility, the Caltech PGPLOT package (SUN/15) may be used. PGPLOT was expressly designed to meet the requirements of astronomers, and is especially good at publication-quality laserprinter output. PGPLOT exists in two forms, one using GKS and the other with native low level and device driver layers, which gives it certain portability advantages for astronomers wishing to send their applications overseas. The two forms are of comparable performance except in greyscale output, where GKS is substantially faster. PGPLOT is moderately flexible, and gives good access to colour and multiple text fonts. However, direct access to GKS during use of PGPLOT is prohibited, limiting the package’s capabilities to those explicitly provided by PGPLOT itself.

NAG:   The NAG Graphical Supplement (currently available only at certain sites – see RAL LUN/45) also draws complete graphs, in a number of useful though spartan formats. It has portability advantages, however, especially for users of UK university computing facilities. Some direct access to GKS is possible.

NCAR & SNX:   The NCAR package, (SUN/88) supplied by the National Center for Atmospheric Research, is widely available and runs on many different types of computer (n.b./ recent versions are proprietary). The Starlink SNX routines (SUN/90) allow the NCAR routines to be used in conjunction with SGS, and direct use of GKS facilities is also possible. The most important of the NCAR utilities is AUTOGRAPH, which draws complete plots of one variable against another. Great flexibility is available, and effects can be achieved which are impossible with other packages of comparable level. For example numeric labels can be intercepted and replaced; opposite axes can have different scales (including non-linear ones), lines can have embedded captions, and so on.

IDI:   The IDI package (SUN/65) differs in its objectives from all those mentioned so far, which are mainly oriented towards line-drawing. IDI is a low-level interface for image display devices, and supports concepts absent in GKS, for instance re-configurable pixel memory. Compared with the GKS-based packages, IDI’s drawing facilities are rather primitive, but IDI comes into its own for highly interactive applications, involving special cursors, pan/zoom, blink etc.

AGI & GNS:   Two supporting packages are the Graphics Database library AGI (SUN/48) and the Graphics Name Service library GNS (SUN/57). AGI remembers what has been plotted where and allows one applications to access the plotting of another. GNS is a unified naming scheme which is supported across all the Starlink graphics packages. Application programmers should be fully aware of what these packages do, should make full use of these facilities, and should not duplicate their functions in application code.

Mixtures:   With care, several of the plotting packages can be used in conjunction with one another. The various packages interrelate with each other and with applications in ways which are unfortunately too complicated and varied to permit a simple diagram to be drawn or a simple set of rules to be laid down. The techniques available depend on the particular combination of packages involved, and guidance should be sought from the documents describing those packages. The SGS, SNX, NCAR and GKS packages are more miscible than some of the others. It is normally safe to use the packages sequentially; the dangers lie in calls to one package deranging the context of one of the others. The difficulties and complications of this area are a direct result of offering the utmost flexibility. Those who prefer safety and simplicity would be well advised to stick to a single package (for example PGPLOT) used in a straightforward way.


Don’t interpret graphics device names or numbers !!! 64
Do not examine in applications the GKS/SGS/GNS workstation type or name in order to control the behaviour of the program. For example, you are not allowed to say “the GKS workstation type is 3200, therefore this is an Ikon image display, therefore colour is available". This information must be obtained by calling the appropriate GKS, SGS, PGPLOT or GNS enquiry routines; if the property you are interested in is not available through such enquiries then devise some mechanism external to the program, or solicit information from the user.