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:
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:
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
COORD: rect(dim(1,2))
GUIDE: axis(dim(2), label("Mean Salary"))