1. Home
  2. AXES directive

AXES directive

Defines the x- and y-axis in each window for high-resolution graphics.


EQUAL = string tokens Whether/how to make axes equal (no, scale, lower, upper); default no
RESET = string token Whether to reset the axes definitions to the default values (yes, no); default no


WINDOW = scalars Numbers of the windows
YTITLE = texts Title for the y-axis in each window
XTITLE = texts Title for the x-axis in each window
YLOWER = scalars Lower bound for y-axis
YUPPER = scalars Upper bound for y-axis
XLOWER = scalars Lower bound for x-axis
XUPPER = scalars Upper bound for x-axis
YMARKS = scalars or variates Distance between each tick mark on y-axis (scalar) or positions of the marks (variate)
XMARKS = scalars or variates Distance between each tick mark on x-axis (scalar) or positions of the marks (variate)
YMPOSITION = string tokens Position of the tick marks across the y-axis (left, right, centre)
XMPOSITION = string tokens Position of the tick marks across the x-axis (above, below, centre)
YLABELS = texts Labels at each mark on y-axis
XLABELS = texts Labels at each mark on x-axis
YLPOSITION = string tokens Position of the labels for the y-axis (left, right)
XLPOSITION = string tokens Position of the labels for the x-axis (above, below)
YORIGIN = scalars Position on y-axis at which x-axis is drawn
XORIGIN = scalars Position on x-axis at which y-axis is drawn
STYLE = string tokens Style of axes (none, x, y, xy, box, grid)
PENTITLE = scalars Pen to use for the title
PENAXES = scalars Pen to use for the axes and their labelling
PENGRID = scalars Pen to use for the grid
SAVE = pointers Saves details of the current settings for the axes concerned


There is a definition for the x- and y-axis associated with each Genstat graphics window. This specifies how the axes are to be drawn when graphical output is produced in that window. The default definition for each set of axes requires some of the features to be determined from the data, as described below. Others have fixed defaults that are independent of the data. The AXES directive can be used to override the default action and specify explicitly how particular parts of the axis are drawn. All parameters of AXES are relevant when using DGRAPH, but for other directives only some of the parameters are used.

The graphical attributes controlled by AXES can be set more conveniently using the directives XAXIS, YAXIS and ZAXIS, and extensions to the FRAME directive, that were introduced in Release 4.2. AXES has been retained to enable existing programs to run, but it is recommended that for new programs FRAME, XAXIS, YAXIS and ZAXIS be used instead.

The WINDOW parameter specifies the window whose axes definitions are to be altered. WINDOW can be set to a list of window numbers, in which case the other parameter lists are cycled in the usual way. By default, only those aspects specified by subsequent parameter lists are modified; any parameters that are not set will retain their current settings. Alternatively, you can specify option RESET=yes to reset the values of any parameters that are not set for each window, back to the default values that are set up by Genstat at the start of a job.

The YLOWER and YUPPER parameters specify the lower and upper bounds for the y-axis. By default, Genstat derives suitable axis bounds from the data, as described for the appropriate directive. You can set the lower bound to a value greater than the upper bound, to obtain an inverted data scale, but the bounds must not be equal. The XLOWER and XUPPER parameters set bounds for the x-axis in a similar way. The values specified with these parameters are on the scale of the data values that are plotted, and are independent of the normalized device coordinates used to define the window size in FRAME. The EQUAL option can be used to ensure that equal upper or lower bounds are used for the y- and x-axes. For example, if EQUAL=lower, lower bounds for both axes will be set to the lower of the values determined automatically from the data. The bounds obtained when using the EQUAL option may be constrained by settings of other parameters: for example, if YUPPER is set and EQUAL=upper, the upper bounds of both axes are set to the value specified by YUPPER; but if XUPPER is also set, EQUAL will be ignored. You can set EQUAL=lower,upper to constrain both upper and lower bounds, and EQUAL=scale can be used to ensure physical distance is equal on both axes, for example the y-axis could range from 0 to 100 and the x-axis from 100 to 200.

The YORIGIN parameter determines the value on the y-axis through which the x-axis is drawn. If its value is outside the y-axis bounds, the upper or lower bound is adjusted so that the axis will extend up to the specified origin. This applies whether you have set the bounds explicitly or have left Genstat to calculate them from the data. The XORIGIN parameter sets the origin for the x-axis in a similar way. By default, the lower bounds of each axis are used, so that the axes are drawn on the bottom and left-hand sides of the plot.

Titles can be added to the axes using the YTITLE and XTITLE parameters. In each case, the title is limited to a single line of characters.

Each axis is marked with a scale, determined automatically so that tick marks are evenly spaced and positioned to give “round” numbers for the scale values. For each axis, you can specify either the increment between tick marks or their actual positions. You can also specify labels to use for scale markings instead of their numerical values.

To specify the increment on the y-axis, the YMARKS parameter should be set to a scalar. For example, YMARKS=1.5 with bounds 10 and 2 causes tick marks to appear at 2, 3.5, 5, 6.5, 8 and 9.5. The interval must be a positive number, irrespective of the values of the bounds. Alternatively, you can set YMARKS to a variate (with more than one value) to specify the actual positions of the tick marks on the y-axis. Any values that lie outside the axis bounds are ignored. The scale values printed next to the tick marks use a format that is determined automatically from the values, but if you have set YMARKS to a variate it will use the number of decimals specified in the variate declaration. When you have set YMARKS, you can also use the YLABELS parameter to specify a set of labels to mark the axis scale. For example,

TEXT [VALUES=Mon,Tues,Wed,Thur,Fri,Sat,Sun] Day

VARIATE [VALUES=1...31] Month


The strings within the text are cycled if necessary; hence, the number of strings can be less than the number of tick marks.

The tick marks can be drawn to the left or to the right of the axis, or can be centred (that is, across the axis). By default, the tick marks are drawn towards the “outside” of the plot; that is, to the left if the y-axis is to the left of the centre of the plot, or to the right if the y-axis is drawn to the right of centre. The aim is to position the tick marks away from the main part of the plot, so that they interfere with the plotted points as little as possible. You can control the positioning of the tick marks by setting the YMPOSITION parameter to either left, right or centre. A similar rule governs the default positioning of the scale markings or labels, but you can again control this by setting the YLPOSITION parameter to either left or right. Setting YMARKS=* will return to the default positioning of the tick marks; YLABELS=* will switch off any labels previously specified; and YMPOSITION=* and YLPOSITION=* will switch off tick marks or labels altogether.

Annotation of the x-axis can be controlled in a similar way using the XMARKS, XLABELS, XMPOSITION and XLPOSITION parameters, except that the settings left and right are replaced by above and below.

The STYLE parameter controls the type of axes that are drawn. By default STYLE=xy, so both y- and x-axes are plotted. Alternative settings allow the axes to be completed by drawing a box around the graph, with an overlaid grid if required. The settings STYLE=x and STYLE=y can be used if only one axis is required. Finally, STYLE=none inhibits the plotting of axes completely, although some other parameters, such as YLOWER, may still have an effect on the plotted data.

There are three parameters that control the pens to be used when drawing the axes. These are PENTITLE, PENAXES and PENGRID, specifying the pen for the title, the axes and annotation, and the grid, respectively. The initial default is to use pens -1, -2 and -4 in every window. These pens are given negative numbers to allow them to be distinguished from the pens used for the contents of the plot. They are initially set up to use colour 1, line style 1, thickness 1, size 1 and font 1. You can thus control which pens are used for drawing the axes in each window, and the attributes of those pens. For example, if no AXES statement has yet been given,


will request that the grids in every window should be drawn in line style 4 and colour 2; while



will change the appearance of just the axes in window 1, as pen 29 is not used for the other windows. Control of the grid pen is particularly useful as a combination of colour and line style can be chosen to ensure that the grid does not obscure the plotted points. You should of course be careful of side-effects when changing the pen numbers. For example, pen 29 may also have been modified for use in a DGRAPH statement and other attributes may have been set that are not wanted when drawing the axes.

Axis annotation is plotted in the margins specified by the FRAME directive. You may wish to reduce the size of these margins if you have defined axes that use less space, for example by keeping within the area of the graph itself, or by omitting titles or labels. Space can thus be regained and used for plotting data. However, if the margins are too small the axis annotation may be “clipped” at the boundaries of the margins; if this happens, you can use FRAME to increase the margin size. The margins are used by DGRAPH, DHISTOGRAM and DCONTOUR, but they are ignored by other directives.

The current settings of the axes for a particular window can be saved in a pointer supplied by the SAVE parameter. The elements of the pointer are labelled to identify the components. This facility is of most use within procedures, where it may be necessary to check or modify particular AXES settings before constructing complicated graphs. Also, the DKEEP directive allows you to extract the actual bounds used when plotting; these will be the bounds determined from the data if none have been defined explicitly by AXES.

Options: EQUAL, RESET.


See also


Commands for: Graphics.

Updated on June 20, 2019

Was this article helpful?