
Add text to a tree plot.
# S3 method for tree
text(x, splits = TRUE, label = "yval", all = FALSE,
pretty = NULL, digits = getOption("digits") - 3,
adj = par("adj"), xpd = TRUE, ...)
None.
an object of class "tree"
logical. If TRUE
the splits are labelled
The name of column in the frame
component of
x
, to be used to label the nodes. Can be NULL
to
suppress node-labelling
logical. By default, only the leaves are labelled, but if true interior nodes are also labelled.
the manipulation used for split labels involving attributes. See Details.
significant digits for numerical labels.
graphical parameters such as cex
and font
.
B. D. Ripley
If pretty = 0
then the level names of a factor split attributes
are used unchanged. If pretty = NULL
, the levels are presented
by a
, b
, ... z
, 0
... 5
. If
pretty
is a positive integer, abbreviate
is
applied to the labels with that value for its argument
minlength
.
If the lettering is vertical (par srt = 90
) and adj
is
not supplied it is adjusted appropriately.
plot.tree
ir.tr <- tree(Species ~., iris)
plot(ir.tr)
text(ir.tr)
Run the code above in your browser using DataLab