paintSubTree: Paint sub-trees with a discrete character

Description Usage Arguments Value Author(s) References See Also


This function maps or "paints" an arbitrary, i.e., user-specified, discrete character history on the tree. paintSubTree paints the clade downstream of node with a particular state; whereas paintBranches paints only a specified branch.


paintSubTree(tree, node, state, anc.state="1", stem=FALSE)
paintBranches(tree, edge, state, anc.state="1")



a phylogenetic tree as an object of class "phylo" or a modified object with mapped character traits.


an integer specifying the node number tipward of which the function should paint the derived state.


an integer or vector of integers specifying the node or tip numbers of the edges that should be painted in paintBranches.


a string (or numeric value) specifying the state to paint on the tree tipward of node.


the ancestral state to use; will only be applied if there are presently no character values mapped on the tree.


logical or numeric value indicating whether to use the derived state on the stem leading to node (or not, if stem=FALSE), or, alternatively, what fraction of the stem should be assigned to the derived clade. Note that for tip clades stem=FALSE is not allowed.


A modified phylogenetic tree of class "phylo" with the following additional elements:


a list of named vectors containing the times spent in each state on each branch, in the order in which they occur.


a matrix containing the total time spent in each state along each edge of the tree.


Liam Revell


Revell, L. J. (2012) phytools: An R package for phylogenetic comparative biology (and other things). Methods Ecol. Evol., 3, 217-223.

See Also

make.simmap, read.simmap, plotSimmap, sim.history

Search within the phytools package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.