1. Home
  2. YAXIS directive

YAXIS directive

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


RESET = string token Whether to reset the axis definition to the default values (yes, no); default no


WINDOW = scalars Numbers of the windows
TITLE = texts Title for the axis
TPOSITION = string tokens Position of title (middle, end)
TDIRECTION = string tokens Direction of title (parallel, perpendicular)
LOWER = scalars Lower bound for axis
UPPER = scalars Upper bound for axis
MARKS = scalars or variates Distance between each tick mark (scalar) or positions of the marks along the axis (variate)
MPOSITION = string tokens Positioning of the tick marks on the axis (inside, outside, across)
LABELS = texts or variates Labels at each major tick mark
LPOSITION = string tokens Position of the axis labels (inside, outside)
LDIRECTION = string tokens Direction of the axis labels (parallel, perpendicular)
LROTATION = scalars or variates Rotation of the axis labels
NSUBTICKS = scalars Number of subticks per interval (ignored if MARKS is a variate)
XORIGIN = scalars Position on x-axis at which the axis is drawn
ZORIGIN = scalars Position on z-axis at which the axis is drawn
PENTITLE = scalars Pen to use to write the axis title
PENAXIS = scalars Pen to use to draw the axis
PENLABELS = scalars Pen to use to write the axis labels
ARROWHEAD = string tokens Whether the axis should have an arrowhead (include, omit)
ACTION = string tokens Whether to display or hide the axis (display, hide)
TRANSFORM = string tokens Transformed scale for the axis (identity, log, log10, logit, probit, cloglog, square, exp, exp10, ilogit, iprobit, icloglog, root); default iden
LINKED = scalars Linked axis whose definitions should be used for this axis in 2-dimensional graphs; default * i.e. none
MLOWER% = scalars How large a margin to set between the lowest y-value and the lower value of the axis, if not set explicitly by LOWER (expressed as a percentage of the range of the y-values)
MUPPER% = scalars How large a margin to set between the largest y-value and the upper value of the axis, if not set explicitly by UPPER (expressed as a percentage of the range of the y-values)
DECIMALS = scalars or variates Number of decimal places to use for numbers printed at the marks
DREPRESENTATION = scalars, variates or texts Format to use for dates and times printed at the marks
VREPRESENTATION = string tokens Format to use for numbers printed at the marks (decimal, engineering, scientific); default deci
XOMETHOD = string tokens Method to use to set the position of the origin on the x-axis if not set explicitly by XORIGIN (upper, lower, center, centre)
ZOMETHOD = string tokens Method to use to set the position of the origin on the z-axis if not set explicitly by ZORIGIN (upper, lower, center, centre)
REVERSE = string tokens Whether to reverse the axis direction to run from upper to lower instead of the default lower to upper (yes, no); default no
SAVE = pointers Saves details of the current settings for the axis concerned


There is a definition for the y-axis associated with each Genstat graphics window. This specifies how the y-axis is to be drawn when graphical output is produced in that window. The default definition for each axis requires some of the features to be determined from the data. Others have fixed defaults that are independent of the data. The YAXIS directive can be used to override the default action and specify particular aspects of the y-axis explicitly. (Similarly, directives XAXIS and ZAXIS modify the x- and z-axis definitions, respectively.) All the parameters of YAXIS are relevant when using DGRAPH, but for other directives only some of the parameters are used. The syntax of YAXIS is identical to that of XAXIS, except that YAXIS has an XORIGIN parameter which replaces the YORIGIN parameter of XAXIS.

The WINDOW parameter specifies the window whose axis definition is to be altered. WINDOW can be set to a list of window numbers, in which case the other parameter lists are cycled in parallel, 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.

As in XAXIS, the LOWER, UPPER, MLOWER% and MUPPER% parameters can specify the lower and upper bounds for the axis, the REVERSE parameter can reverse the axis, and the TITLE, TPOSITION and TDIRECTION parameter can define a title for the axis.

The XORIGIN parameter determines the value on the x-axis through which the axis is drawn. If its value is outside the x-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. If XORIGIN is not set, the XOMETHOD parameter can specify how the position should be determined: either at the upper value on the x-axis, or the lower value, or in the centre. The initial default (if neither of these parameters has been specified) is to put the axis at the left-hand end, which will be the lower value unless the scale is reversed. The ZORIGIN and ZOMETHOD parameters set the position of the origin on the z-axis in a similar way, with the initial default that the axis is at the bottom of the z-axis.

The MARKS, NSUBTICKS, LABELS, DECIMALS, DREPRESENTATION and VREPRESENTATION parameters also operate as in XAXIS, to specify the markings on the axis, and their associated labels. The MPOSITION, LPOSITION, LDIRECTION and LROTATION parameters again control the positioning of the tick marks and labels. For a y-axis, the outside setting implies that the tick marks are drawn to the left of the axis if the axis is on the left-half side of the plot, or to the right of the axis if it is on the right-hand side. As in XAXIS, the TRANSFORM parameter allows you to transform the physical scale of the axis on the graph.

The ARROWHEAD parameter again controls whether the axis is drawn with an arrowhead at the end, and parameters PENTITLE, PENAXIS and PENLABEL specify the pen to be used for the title, the axis and the labelling, respectively. ACTION allows you to hide the axis, LINKED allows you to take all the axis settings from a (linked) axis in another window, and SAVE allows you to save the current settings defined for the axis. Further details are given in the description of XAXIS.

Option: RESET.


See also


Procedure: DHELP.

Commands for: Graphics.


" Example DGRA-1: Draw a scatter plot"

" File DGRA-1.DAT contains data on deaths from lung cancer and smoking
  rates in 11 countries in 1930, from a US report in 1964."

" Read the data recorded in the file."
FILEREAD [NAME='%gendir%/examples/DGRA-1.DAT'] country,deaths,cigarettes

" Display the data in a high-resolution graph."
TEXT cancer; VALUES='Lung cancer and smoking in 1930'
DGRAPH [TITLE=cancer; WINDOW=3; KEYWINDOW=0] deaths; cigarettes

" Add the axis titles and bounds, and a grid."
XAXIS WINDOW=3; TITLE='Cigarettes per man per year'; LOWER=0
YAXIS WINDOW=3; TITLE='Deaths per million'; LOWER=0
DGRAPH [TITLE=cancer; WINDOW=3; KEYWINDOW=0] deaths; cigarettes

" Specify the axis labelling precisely."
XAXIS WINDOW=3; MARKS=!(0,300...1500)
DGRAPH [TITLE=cancer; WINDOW=3; KEYWINDOW=0] deaths; cigarettes

" Label the points with the names of the countries."
PEN 1; LABELS=country; SYMBOLS=0
DGRAPH [TITLE=cancer; WINDOW=3; KEYWINDOW=0] deaths; cigarettes; PEN=1

" Fit a linear regression line (assuming variance proportional
  to the square of the mean) to the relationship and
  add the fitted line to the graph."
MODEL [DISTRIBUTION=gamma; LINK=identity] deaths
FIT [PRINT=*] cigarettes
DGRAPH [SCREEN=keep; WINDOW=3; KEYWINDOW=0] fit; cigarettes; PEN=2
Updated on October 28, 2020

Was this article helpful?