Plot Text

DESCRIPTION:
Places text at the given positions in the current plot.

This function is generic (see Methods); method functions can be written to handle specific classes of data. Classes which already have methods for this function include: tree.


USAGE:
text(x, ...)

text.default(x, y, labels=seq(along=x), cex=par("cex"), col=par("col"))


REQUIRED ARGUMENTS:
x:
an S-PLUS object.

OPTIONAL ARGUMENTS:
y:
for text.default, x and y are the coordinates of the points. The coordinates can be given by two arguments that are vectors, or by a single argument x which is a univariate time series, a complex vector, a matrix with 2 columns, or a list containing components named x and y.
labels:
vector of labels for each point. Normally, labels[i] is plotted at each point (x[i],y[i]); however, if labels is a logical vector of the same length as x and y, the value i is plotted at each (x[i],y[i]) for which labels[i] is TRUE.
Missing values (NA) are allowed.
cex:
character expansion parameter (see par) for each text string. This may be a vector of more than one element.
col:
color parameter (see par) for each text string. This may be a vector of more than one element.

Graphical parameters may also be supplied as arguments to this function (see par).


SIDE EFFECTS:
text is added to the current plot. The graphical parameter adj (see par) determines whether the text is right, left or center justified.

DETAILS:
Labels are not plotted at any point with a missing x or y coordinate or a missing label.

If the lengths of x, y, labels, cex, and col are not identical, the shorter vectors are reused cyclically.

The text function can be used after plot(x,y,type="n") which draws axes and the surrounding box without plotting the data.


BUGS:
The strings in the labels argument will be truncated to their first 511 characters.

SEE ALSO:
mtext , title , symbols , par .

EXAMPLES:
plot(x, y, type="n")
text(x, y)  #plot i at (x[i], y[i])

plot(x1, f1, type="l"); lines(x2, f2) text(.3, .7, "function 1"); text(.3, .4, "function 2")