1. Home
  2. CONTOUR directive

CONTOUR directive

Produces contour maps of two-way arrays of numbers on the terminal or line printer (synonym of LPCONTOUR).

Options

CHANNEL = scalar Channel number of output file; default is current output file
INTERVAL = scalar Contour interval for scaling; default * i.e. determined automatically
TITLE = text General title; default *
YTITLE = text Title for y-axis; default *
XTITLE = text Title for x-axis; default *
YLOWER = scalar Lower bound for y-axis; default 0
YUPPER = scalar Upper bound for y-axis; default 1
XLOWER = scalar Lower bound for x-axis; default 0
XUPPER = scalar Upper bound for x-axis; default 1
YINTEGER = string token Whether y-labels integral (yes, no); default no
XINTEGER = string token Whether x-labels integral (yes, no); default no
LOWERCUTOFF = scalar Lower cut-off for array values; default *
UPPERCUTOFF = scalar Upper cut-off for array values; default *

Parameters

GRID = identifiers Pointers (of variates representing the columns of a data matrix), matrices or two-way tables specifying values on a regular grid
DESCRIPTION = texts Annotation for key

Description

The CONTOUR directive has been replaced by the LPCONTOUR directive, and may be removed in a future release or modified to produce high-resolution plots instead of character-based plots.

A contour plot provides a way of displaying three-dimensional data in a two-dimensional plot. The data values are supplied as a rectangular array of numbers that represent the values of the variable in the third dimension, often referred to as height or the z-axis. The first two dimensions (x and y) are the rows and columns indexing the array; the complete three-dimensional data set is referred to as a surface or grid. Contours are lines that are used to join points of equal height, and usually some form of interpolation is used to estimate where these points lie. The resulting contour plot is not necessarily very “realistic” when compared to perspective plots produced by DSURFACE, but it has the advantage that the entire surface can easily be examined, without the danger of some parts being obscured by high points or regions.

You might use contour plots for example when you have data sampled at points on a regular grid, such as the concentrations of a trace element or nutrient in the soil. Contours are also very useful when fitting nonlinear models, when they can be used to study two-dimensional slices of the likelihood surface, to help find good initial estimates of the parameters.

The CONTOUR directive produces output for a line printer by using cubic interpolation between the grid points to estimate a z-value for each character position in the plot. Each value is reduced to a single digit in the range 0 … 9, according to the rules described below. To produce the contour plot only the even digits are printed: you can then see the contours as the boundaries between the blank areas and the printed digits.

The GRID parameter can be set to a matrix, a two-way table (with the first factor defining the rows), or a pointer to a set of variates each containing a column of data. We explain the conventions in terms of a matrix as input, but similar rules apply to the other structures. When reading or printing a matrix the origin of the rows and columns (row 1, column 1) appears at the top left-hand corner. However, in forming the contour plot the rows are reversed in order so that the first row of the matrix is placed at the bottom of the contour; thus the origin of the contour is located, according to the usual conventions, at the bottom left-hand corner of the plot. The DCONTOUR directive also reverses the rows of the grid in the same way.

CONTOUR scales the grid values by dividing by the contour interval. The scaled grid values are then converted to single digits by taking the remainder modulo 10 and truncating the fractional part. The INTERVAL option allows you to set the contour interval. For example, if the grid values range from 17 to 72 and the interval is set to 10, contour lines (the boundaries between blank space and printed digits) will occur at grid values of 20, 30, 40, 50, 60 and 70. By default, the interval is determined from the range of the data in order to obtain 10 contours.

The UPPERCUTOFF and LOWERCUTOFF options can be used to define a window for the grid values that will form the contours. All values above or below these are printed as X. Setting either UPPERCUTOFF or LOWERCUTOFF will change the default contour interval, as the range of data values is effectively curtailed.

You can use the TITLE, YTITLE and XTITLE option to annotate the contour plot. If you specify several grids, these will be plotted in separate frames and the text of the TITLE option will appear at the top of each one. You should thus use TITLE only to give a general description of what the contours represent. The DESCRIPTION parameter can be used to add specific descriptions to be printed at the bottom of each individual plot.

The YUPPER and YLOWER options allow you to set upper and lower bounds for the y-axis; thus generating axis labels that reflect the range of values over which the grid was observed or evaluated. Setting YINTEGER=yes will ensure the labels are printed as integers, if possible. The default axis bounds are 0.0 and 1.0. The options XLOWER, XUPPER and XINTEGER similarly control labelling of the x-axis.

Options: CHANNEL, INTERVAL, TITLE, YTITLE, XTITLE, YLOWER, YUPPER, XLOWER, XUPPER, YINTEGER, XINTEGER, LOWERCUTOFF, UPPERCUTOFF.

Parameters: GRID, DESCRIPTION.

Action with RESTRICT

CONTOUR takes account of restrictions on any of the variates in a GRID pointer.

See also

Directives: DCONTOUR, LPCONTOUR.

Commands for: Graphics.

Updated on June 20, 2019

Was this article helpful?