GTEXT and GVTEXT Calls

CALL GTEXT (x, y, text <, color> <, window> <, viewport> ) ;

CALL GVTEXT (x, y, text <, color> <, window> <, viewport> ) ;

The GTEXT subroutine places text horizontally on a graph; the GVTEXT subroutine places text vertically on a graph.

The required arguments to the GTEXT and GVTEXT subroutines are as follows:

x

is a scalar or vector that contains the horizontal coordinates of the lower left starting position of the text string’s first character.

y

is a scalar or vector that contains the vertical coordinates of the lower left starting position of the text string’s first character.

text

is a vector of text strings.

The optional arguments to the GTEXT and GVTEXT subroutines are as follows:

color

is a valid SAS 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.

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 GTEXT subroutine places text horizontally on a graph; the GVTEXT subroutine places text vertically on a graph. Both subroutines use hardware characters when possible. The number of text strings drawn is the maximum dimension of the first three vectors. The color argument can have more than one element. Hardware characters cannot always be obtained if you use a viewport or if you change the HEIGHT or ASPECT parameters by using the GSET subroutine or the GOPTIONS statement. The coordinates in use for this graphics command are world coordinates.

Examples of the GTEXT and GVTEXT subroutines follow:

call gstart;
call gopen;
call gport({0 0 50 50});
call gset("height", 3); /* set character height */
msg = "GTEXT: This will start in the center of the viewport";
call gtext(50, 50, msg);
msg = "GVTEXT: Vertical string";
call gvtext(0.35, 10, msg, 'red', {0.2 -1, 1.5 6.5}, {0 0, 100 100});
call gshow;