dim Function (GPL)

Syntax

dim(<numeric> ...)

<numeric>. A numeric value identifying the dimension or dimensions. If you are specifying multiple dimensions, use commas to separate the numeric values.

Description

Specifies the dimension or dimensions to which a coordinate type, scale, guide, or function applies.

To figure out the numeric value associated with a dimension, look at the algebra. Counting the crossings gives the main dimension values. The coordinate system (including any clustering of the coordinate system) doesn't matter.

Consider the following algebra:

a*b*c*d

The variables in the algebra correspond to the following dimensions:

Table 1. Variables and dimensions
Variable Dimension
a dim(1)
b dim(2)
c dim(3)
d dim(4)

Blended variables cannot be separated. The blend of the two variables corresponds to one dimension. Consider the following:

a*(b+c)*d

The variables in the algebra correspond to the following dimensions:

Table 2. Variables and dimensions with blended variables
Variable Dimension
a dim(1)
b+c dim(2)
d dim(3)

With nesting, you still count crossed variables, but nested groups are counted only once. To refer to each variable in the nested group, you count from the outside in, using a dot convention. The outermost variable in the nested group gets the primary dimension number (for example, dim(1)), and the next variable gets the primary dimension number followed by a dot and a 1 (for example, dim(1.1)). Consider the following:

a*b/c*d

The variables in the algebra correspond to the following dimensions:

Variable Dimension
a dim(1)
c dim(2)
b dim(2.1)
d dim(3)

Examples

Figure 1. Example: Specifying a two-dimensional, rectangular coordinate system
COORD: rect(dim(1,2))
Figure 2. Example: Specifying an axis label for the second dimension
GUIDE: axis(dim(2), label("Mean Salary"))