DEVICE directive

Switches between (high-resolution) graphics devices.

 

No options

 

Parameters

NUMBER = scalar Device number
ENDACTION = string token Action to be taken after completing each plot (continue, pause)
ORIENTATION = string token Orientation of the pictures, if relevant (landscape, portrait); default * retains the current setting for this device
PALETTE = string token How to represent colour (monotone, greyscale, grayscale, colour); default * retains the current setting for this device
SIZEPAGE = string token Size of page for each screen (A4, A3); default * retains the current setting for this device
RESOLUTION = scalar Specifies the height of the image for hard-copy output, in pixels
ACTION = string token How to create graphs for file types such as .emf, .jpg, .tif or .png (asynchronous, synchronous); default asyn

 

Description

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 DHELP procedure.

The output device is selected by the DEVICE statement. For example

DEVICE 4

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 OPEN and CLOSE statements. When opening or closing files for graphical output the CHANNEL parameter of the OPEN and CLOSE statements should be set to the device number specified by the DEVICE statement. For example:

OPEN 'PLOT.HPGL'; CHANNEL=4; FILETYPE=graphics

DEVICE 4

DGRAPH Y; X

CLOSE 4; 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.

The ENDACTION parameter, with settings continue and 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 pause or continue when you start Genstat, according to the particular implementation. If you are running in batch mode the default will always be to continue.

You can repeat the DEVICE statement and set ENDACTION to pause or 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 DGRAPH statement.

The ORIENTATION parameter can be used to specify landscape or 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. The SIZEPAGE parameter lets you specify A3 or A4 pagesizes for HPGL devices.

The 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.)

The ACTION parameter controls how graphs are created for the file types .emf, .jpg, .tif, .png, .gmf and .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.

Options: none,

Parameters: NUMBER, ENDACTION, ORIENTATION, PALETTE, SIZEPAGE, RESOLUTION, ACTION.

 

See also

Directives: OPEN, CLOSE, DDISPLAY, DKEEP.

Procedures: DHELP, SETDEVICE.

Commands for: Graphics.

Example

" Example 1:6.9.10a & 1:6.9.1010b "
DEVICE 4
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.hpg'; 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
Updated on January 11, 2018

Was this article helpful?