Function plots a tree with branches colored by the value for a quantitative trait or probability, by various methods. Unlike most other tree plotting functions in phytools, this function calls plot.phylo
(not plotSimmap
) internally.
plotBranchbyTrait(tree, x, mode=c("edges","tips","nodes"), palette="rainbow",
legend=TRUE, xlims=NULL, ...)
an object of class "phylo".
either a vector of states for the edges, tips, or nodes of the tree (for mode="edges"
, "tips"
, and "nodes"
, respectively).
string indicating plotting mode. mode="edges"
, the default, requires that the mapping state of each edge in the tree should be provided. mode="tips"
takes the tip values and estimates the state at each internal node. The mapped character value along each branch is the average of the nodes subtending that branch. mode="nodes"
similar to "tips"
, except that the node values are provided instead of estimated.
color palette to translate character values to color. Options are presently "rainbow"
(the default), "heat.colors"
, and "gray"
. palette
can also be a function produced by colorRampPalette
.
can be a logical value (TRUE
or FALSE
) or a numeric value greater than 0. In the latter case the numeric value gives the length of the plotted legend, which also acts as a scale bar for the branch lengths of the tree.
range for the translation map between trait values and the color map. Should be inclusive of all the values in x
.
other optional arguments to be passed to plot.phylo
- pretty much all arguments are available. In addition, there plotBranchbyTrait
has the following additional optional arguments: tol
a small tolerance value to be added to the range of x
; prompt
for legend=TRUE
, a logical value indicating whether to prompt for the position of the legend (or not) - the default is to put the legend in the lower left hand size of the plot; title
for legend=TRUE
, the title of the legend; and digits
for legend=TRUE
, the number of digits in the quantitative scale of the legend. Finally, cex
can be supplied as either a single numeric value, or as a vector of two different values. If the latter is true than the second element of cex
will be passed internally to the function add.color.bar
.
Plots a phylogeny.
Note that if prompt=TRUE
, the function will prompt for the position of the legend.
Revell, L. J. (2012) phytools: An R package for phylogenetic comparative biology (and other things). Methods Ecol. Evol., 3, 217-223.