identify.phylo: Graphical Identification of Nodes and Tips

Description Usage Arguments Details Value Note Author(s) See Also Examples

Description

This function allows to identify a clade on a plotted tree by clicking on the plot with the mouse. The tree, specified in the argument x, must be plotted beforehand.

Usage

1
2
3
## S3 method for class 'phylo'
identify(x, nodes = TRUE, tips = FALSE,
                  labels = FALSE, ...)

Arguments

x

an object of class "phylo".

nodes

a logical specifying whether to identify the node.

tips

a logical specifying whether to return the tip information.

labels

a logical specifying whether to return the labels; by default only the numbers are returned.

...

further arguments to be passed to or from other methods.

Details

By default, the clade is identified by its number as found in the ‘edge’ matrix of the tree. If tips = TRUE, the tips descending from the identified node are returned, possibly together with the node. If labels = TRUE, the labels are returned (if the tree has no node labels, then the node numbered is returned).

The node is identified by the shortest distance where the click occurs. If the click occurs close to a tip, the function returns its information.

Value

A list with one or two vectors named "tips" and/or "nodes" with the identification of the tips and/or of the nodes.

Note

This function does not add anything on the plot, but it can be wrapped with, e.g., nodelabels (see example), or its results can be sent to, e.g., drop.tip.

Author(s)

Emmanuel Paradis

See Also

plot.phylo, nodelabels, identify for the generic function

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
tr <- rtree(20)
f <- function(col) {
    o <- identify(tr)
    nodelabels(node=o$nodes, pch = 19, col = col)
}
plot(tr)
f("red") # click close to a node
f("green")

## End(Not run)

gjuggler/ape documentation built on May 17, 2019, 6:03 a.m.