Switches between (high-resolution) graphics devices.
||Action to be taken after completing each plot (
||Orientation of the pictures, if relevant (
||How to represent colour (
||Specifies the height of the image for hard-copy output, in pixels|
||How to create graphs for file types such as
High-resolution graphics can be generated principally in two forms by Genstat: either on a screen that can operate in graphics mode or by sending output to a file. The screen-based operation is for use in interactive sessions, whereas file output is designed for later use outside Genstat: either to produce hard-copy on a plotter or laser-printer, or to re-display graphics on the screen, if appropriate software is available. Usually there is a choice of various kinds of screen type or file format. Each type of output, whether screen or file, is referred to as a device; thus, the first step in producing graphical output is selecting a device within Genstat that is appropriate for the hardware that you have available. Genstat has built-in interfaces to several different graphics devices. These vary according to the Genstat implementation. However, a list of the devices and their associated numbers can be obtained using the
The output device is selected by the
DEVICE statement. For example
selects the fourth available device.
If you have selected a file-based device you also need to open a file to receive the output, using the
OPEN directive. This can be done before or after selecting the device, so long as the file has been opened before any output is generated. You can close the file when the graphics are complete; if you want to store separate items of graphical output in individual files you can use a sequence of
CLOSE statements. When opening or closing files for graphical output the
CHANNEL parameter of the
CLOSE statements should be set to the device number specified by the
DEVICE statement. For example:
OPEN 'Plot.jpg'; CHANNEL=7; FILETYPE=graphics
DGRAPH Y; X
CLOSE 7; FILETYPE=graphics
The default device, selected automatically when you start Genstat, is device 1: sometimes you may be able to specify an alternative device number and associated output file on the command line used to start Genstat (the local Genstat documentation should explain if this is possible).
You may get strange results if you try to generate graphics on a screen that is not designed for displaying graphics, or if you specify the wrong device type, as Genstat is not always able to detect the type of device or screen.
There should be little difference in the use of Genstat graphics on different devices, as all the plotting symbols, brush styles and character output are software-generated by default, using built-in graphics definitions and font files that are supplied with Genstat. The aspects of graphical output that may depend on particular capabilities of the graphics device are identified in Section 6.9 of Part 1 of the Guide to the Genstat Command Language; for example, different defaults may apply to colour and monochrome devices. It may sometimes be advantageous to use particular features of the hardware; for example, other fonts may be available. These device-specific features are usually selected by negative parameter settings (for example,
SYMBOL=-3). Naturally, selection of device-specific attributes may lead to some differences in appearance of the output on different devices.
ENDACTION parameter, with settings
pause, controls the action taken by default at the end of each plot. When using a graphics terminal interactively it may be convenient to pause at the end of a plot to examine the screen. When you are ready to continue, pressing carriage-return or some equivalent key will switch the terminal back to text mode and the Genstat prompt will appear. The
DKEEP directive can provide the precise details for each particular device. For some interactive devices, for example PCs or workstations with separate graphics windows, it may not be necessary to pause. Each device is initialized to either
continue when you start Genstat, according to the particular implementation. If you are running in batch mode the default will always be to
You can repeat the
DEVICE statement and set
continue at any time that you wish to change the default action. Alternatively, each graphical directive has an
ENDACTION option that controls the device at the end of that directive, without altering the general default setting. For example, if you wish to build up a complex display using several
DGRAPH statements with option
SCREEN=keep, you could set
ENDACTION=continue in the
DEVICE statement, then put
ENDACTION=pause in the final
ORIENTATION parameter can be used to specify
portrait orientation of graphical output on PostScript and Interacter raster devices;
portrait is the default.
PALETTE can be set to
monotone, to force all colours to be mapped to colour 1; this is the default for PostScript. Alternatively,
PALETTE=colour produces colour PostScript output, and enables the use of the
COLOUR directive to specify exactly the composition of the colours. The additional setting
PALETTE=greyscale is as for monotone except that area filling (as in histograms) are shaded in grey tones, using the
RED parameter of
COLOUR to define the grey intensity.
RESOLUTION parameter specifies the height of the image for hard-copy output, in pixels. (This is equivalent to setting the image resolution in the Options menu of the Genstat Graphics Viewer.)
ACTION parameter controls how graphs are created for the file types
.bmp. The setting
synchronous creates the graph before executing another command, whereas the setting
asynchronous allows subsequent commands to be executed whilst the graph is created.
Commands for: Graphics.
" Example 1:6.9.10a & 1:6.9.1010b " DEVICE 7 READ Y,X,Y2 74.38 7.523 78.86 57.84 3.920 50.25 86.06 4.326 68.41 81.19 4.858 43.86 57.31 5.310 64.91 51.63 2.038 76.35 65.11 1.626 38.00 63.25 3.496 49.94 57.74 7.135 59.51 60.22 8.137 40.61 55.90 6.396 56.91 46.46 6.027 68.24 88.49 2.738 82.65 89.95 3.291 59.94 78.44 5.540 75.96 84.79 5.636 71.20 71.82 0.940 72.14 55.09 8.877 44.05 86.97 1.587 77.01 49.58 7.941 68.70 : SCALAR Device DKEEP DEVICE=Device; FILE=File; DESCRIPTION=Name PRINT Name,Device,File IF File OPEN 'Graph.jpg'; CHANNEL=Device; FILETYPE=graphics ENDIF DGRAPH [WINDOW=5;KEYWINDOW=7] Y; X " Now set up window 6 to have the same bounds as window 5, so that Y2 is plotted on the same scale as Y." DKEEP Device; WINDOW=5; YLOWER=Ymin; YUPPER=Ymax; XLOWER=Xmin;\ XUPPER=Xmax PRINT Ymin,Ymax,Xmin,Xmax XAXIS 6; LOWER=Xmin; UPPER=Xmax YAXIS 6; LOWER=Ymin; UPPER=Ymax DGRAPH [WINDOW=6; KEYWINDOW=8; SCREEN=keep] Y2; X CLOSE Device; FILETYPE=graphics; DELETE=yes