Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

text.tree

Annotate a Tree Plot


Description

Add text to a tree plot.

Usage

## S3 method for class 'tree'
text(x, splits = TRUE, label = "yval", all = FALSE,
     pretty = NULL, digits = getOption("digits") - 3, 
     adj = par("adj"), xpd = TRUE, ...)

Arguments

x

an object of class "tree"

splits

logical. If TRUE the splits are labelled

label

The name of column in the frame component of x, to be used to label the nodes. Can be NULL to suppress node-labelling

all

logical. By default, only the leaves are labelled, but if true interior nodes are also labelled.

pretty

the manipulation used for split labels involving attributes. See Details.

digits

significant digits for numerical labels.

adj, xpd, ...

graphical parameters such as cex and font.

Details

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.

Value

None.

Author(s)

B. D. Ripley

See Also

Examples

ir.tr <- tree(Species ~., iris)
plot(ir.tr)
text(ir.tr)

tree

Classification and Regression Trees

v1.0-40
GPL-2 | GPL-3
Authors
Brian Ripley [aut, cre]
Initial release
2019-03-01

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.