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

LabelSplits

Label splits


Description

Labels the edges associated with each split on a plotted tree.

Usage

LabelSplits(tree, labels = NULL, unit = "", ...)

Arguments

tree

A tree of class phylo.

labels

Named vector listing annotations for each split. Names should correspond to the node associated with each split; see as.Splits() for details. If NULL, each splits will be labelled with its associated node.

unit

Character specifying units of labels, if desired. Include a leading space if necessary.

...

Additional parameters to ape::edgelabels().

Details

As the two root edges of a rooted tree denote the same split, only the rightmost (plotted at the bottom, by default) edge will be labelled. If the position of the root is significant, add a tip at the root using AddTip().

Value

LabelSplits() returns invisible(), after plotting labels on each relevant edge of a plot (which should already have been produced using plot(tree)).

See Also

Calculate split support: SplitFrequency()

Colour labels according to value: SupportColour()

Other Splits operations: NSplits(), NTip(), SplitFrequency(), SplitsInBinaryTree(), TipLabels(), TipsInSplits(), as.Splits(), match()

Examples

tree <- BalancedTree(LETTERS[1:5])
splits <- as.Splits(tree)
plot(tree)
LabelSplits(tree, as.character(splits), frame = 'none', pos = 3L)
LabelSplits(tree, TipsInSplits(splits), unit = ' tips', frame = 'none',
            pos = 1L)

# An example forest of 100 trees, some identical
forest <- as.phylo(c(1, rep(10, 79), rep(100, 15), rep(1000, 5)), nTip = 9)

# Generate an 80% consensus tree
cons <- ape::consensus(forest, p = 0.8)
plot(cons)

splitFreqs <- SplitFrequency(cons, forest)
LabelSplits(cons, splitFreqs, unit = '%',
            col = SupportColor(splitFreqs / 100),
            frame = 'none', pos = 3L)

TreeTools

Create, Modify and Analyse Phylogenetic Trees

v1.4.4
GPL (>= 3)
Authors
Martin R. Smith [aut, cre, cph] (<https://orcid.org/0000-0001-5660-1727>), Emmanuel Paradis [cph] (<https://orcid.org/0000-0003-3092-2199>)
Initial release

We don't support your browser anymore

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