GXAXIS and GYAXIS Calls

CALL GXAXIS (starting-point, length, nincr <*>, nminor <*>, noticklab <*>, format <*>, height <*>, font <*>, color <*>, fixed-end <*>, window <*>, viewport ) ;

CALL GYAXIS (starting-point, length, nincr <*>, nminor <*>, noticklab <*>, format <*>, height <*>, font <*>, color <*>, fixed-end <*>, window <*>, viewport ) ;

The GXAXIS subroutine is a graphical call that draws a horizontal axis. The GYAXIS subroutine draws a vertical axis.

The required arguments to the GXAXIS and GYAXIS subroutines are as follows:

starting-point

is the $(x,y)$ starting point of the axis, specified in world coordinates.

length

is a numeric scalar that contains the length of the axis, specified in world coordinates.

nincr

is a numeric scalar that contains the number of major tick marks on the axis. The first tick mark corresponds to starting-point.

The optional arguments to the GXAXIS and GYAXIS subroutines are as follows:

nminor

is an integer that specifies the number of minor tick marks between major tick marks.

noticklab

is a flag that is nonzero if the tick marks are not labeled. The default is to label tick marks.

format

is a character scalar that specifies a valid SAS numeric format used in formatting the tick-mark labels. The default format is 8.2.

height

is a numeric matrix or literal that specifies the character height. This is used for the tick-mark labels.

font

is a character matrix or quoted literal that specifies a valid font name. This is used for the tick-mark labels.

color

is a valid color. The color argument can be specified as a quoted text string (such as 'RED'), the name of a character matrix that contains a valid color as an element, or a color number (such as 1) that refers to a color in the color list.

fixed-end

holds one end of the scale fixed. 'U' fixes the upper end; 'L' fixes the lower end; 'X' allows both ends to vary from the data values. In addition, you can specify 'N', which causes the axis routines to bypass the scaling routine. The interval between tick marks is length divided by (nincr$-1$). The default is 'X'.

window

is a numeric matrix or literal that specifies a window. This is given in world coordinates and has the form

 

{minimum-x minimum-y maximum-x maximum-y}

viewport

is a numeric matrix or literal that specifies a viewport. This is given in normalized coordinates and has the same form as the window argument.

The GXAXIS and GYAXIS subroutines use the same scaling algorithm as the GSCALE subroutine. For example, if the $x$ starting point is 10 and the length of the axis is 44, and if you call the GSCALE subroutine with the $x$ vector that contains the two elements, 10 and 44, the scale obtained should be the same as that obtained by the GXAXIS subroutine. Sometimes, it can be helpful to use the GSCALE subroutine in conjunction with the axis subroutines to get more precise scaling and labeling.

For example, suppose you want to draw the axis for $-2 \leq X \leq 2$ and $-2 \leq Y \leq 2$. The following statements draw these axes. Each axis is four units long. The $x$ axis begins at the point $(-2,0)$, and the $y$ axis begins at the point $(0,-2)$. The tick marks can be set at each integer value, with minor tick marks in between the major tick marks. The tick marks are labeled because the noticklab option has the value 0.

call gstart;
call gport({20 20 80 80});
call gwindow({-2 -2 2 2});
call gxaxis({-2,0}, 4, 5, 2, 0);
call gyaxis({0,-2}, 4, 5, 2, 0);
call gshow;