The XYOUTS procedure draws text on the currently-selected graphics device starting at the designated coordinate.

Arguments X , Y , and String can be any combination of scalars or arrays. If the arguments are arrays, multiple strings are output.

If the optional X and Y arguments are omitted, the text is positioned at the end of the most recently output text string.

Important keywords that control the appearance and positioning of the text include: ALIGNMENT, the justification of the text; CHARSIZE, the size of the text; FONT, chooses between vector drawn and hardware fonts; COLOR, the color of the text; and ORIENTATION, the angle between the baseline of the text and the horizontal. With hardware fonts, most of the text attributes, (e.g., size and orientation), are predetermined and not changeable.

Calling Sequence

XYOUTS, [X, Y,] String


X, Y

The horizontal and vertical coordinates used to position the string(s). X and Y are normally interpreted in data coordinates. The DEVICE and NORMAL keywords can be used to specify the coordinate units.

X and Y can be arrays of positions if String is an array.


The string(s) to be output. This argument can be a scalar string or an array of strings. If this argument is not a string, it is converted prior to use using the default formatting rules. If String is an array, X , Y , and the COLOR keyword can also be arrays so that each string can have a separate location and color.



Specifies the alignment of the text baseline. An alignment of 0.0 (the default) aligns the left edge of the text baseline with the given ( x , y ) coordinate. An alignment of 1.0 right-justifies the text, while 0.5 results in text centered over the point ( x , y ).


The overall character size for the annotation. A CHARSIZE of 1.0 is normal. Setting CHARSIZE = -1 suppresses output of the text string.


The line thickness of the vector drawn font characters.This keyword has no effect when used with the hardware drawn fonts. The default value is 1.0.


This keyword specifies the plane of vector drawn text when three-dimensional plotting is enabled. By default, text is drawn in the plane of the XY axes. The horizontal text direction is in the X plane, and the vertical text direction is in the Y plane. Values for this keyword can range from 0 to 5, with the following effects: 0 for XY, 1 for XZ, 2 for YZ, 3 for YX, 4 for ZX, and 5 for ZY. The notation ZY means that the horizontal direction of the text lies in the Z plane, and the vertical direction of the text is drawn in the Y plane.


Set this keyword to a named variable in which to return the width of the text string, in normalized coordinate units.

Graphics Keywords Accepted

See , Graphics Keywords , for the description of graphics and plotting keywords not listed above. CLIP


Print the string "This is text" at device coordinate position (100,100) by entering:

XYOUTS, 100, 100, 'This is text', /DEVICE

Print an array of strings with each element of the array printed at a different location. Use larger text than in the previous example. Enter:

XYOUTS, [0, 200, 250], [200, 50, 100], $

   ['This', 'is', 'text'], CHARSIZE = 3, /DEVICE

To determine the text size for a window device before opening an on-screen window, enter:


XYOUTS, 'Check this out', WIDTH=w


(where myWinXSize and myWinYSize are chosen to match your onscreen window.) Since we can not know the characteristics of a given device (such as character size) until a window has been opened, the PIXMAP keyword to WINDOW allows you to compute appropriate dimensions for text with an invisible window before displaying a window on your screen.

See Also