Language Reference |
GSCALE Call |
The GSCALE subroutine computes a suitable scale and tick values for labeling axes.
The required arguments to the GSCALE subroutine are as follows:
is a returned vector that contains the scaled minimum data value, the scaled maximum data value, and a grid increment.
is a numeric matrix or literal.
is the number of intervals desired.
The optional arguments to the GSCALE subroutine are as follows:
is numeric and provides up to 10 numbers to use for scaling. By default, nicenum is the vector {1,2,2.5,5}.
is a character argument that specifies which end of the scale is held fixed. The default is 'X'.
The GSCALE subroutine obtains simple (round) numbers with uniform grid interval sizes to use in scaling a linear axis. The GSCALE subroutine implements Algorithm 463 (Lewart; 1973) of the Collected Algorithms from Association for Computing Machinery (ACM). The scale values are integer multiples of the interval size. They are returned in the first argument, a vector with three elements. The first element is the scaled minimum data value. The second element is the scaled maximum data value. The third element is the grid increment.
The required input parameters are x, a matrix of data values, and nincr, the number of intervals desired. If nincr is positive, the scaled range includes approximately nincr intervals. If nincr is negative, the scaled range includes exactly ABS(nincr) intervals. The nincr parameter cannot be zero.
The nicenum and fixed-end arguments are optional. The nicenum argument provides up to 10 numbers, all between 1 and 10 (inclusive of the endpoints), to be used for scaling. The default for nicenum is 1, 2, 2.5, and 5. The linear scale with this set of numbers is a scale with an interval size that is the product of an integer power of 10 and 1, 2, 2.5, or 5. Changing these numbers alters the rounding of the scaled values.
For fixed-end, 'U' fixes the upper end; 'L' fixes the lower end; 'X' allows both ends to vary from the data values. The default is 'X'. An example that uses the GSCALE subroutine follows:
x = normal( j(100,1) ); /* generate standard normal data */ call gscale(scale, x, 5); /* ask for about 5 intervals */ ticks = do(scale[1], scale[2], scale[3]); print scale, ticks;
Copyright © SAS Institute, Inc. All Rights Reserved.