contMap | R Documentation |
Projects the observed and reconstructed values of a continuous trait onto the edges of a tree using a color gradient.
contMap(tree, x, res=100, fsize=NULL, ftype=NULL, lwd=4, legend=NULL,
lims=NULL, outline=TRUE, sig=3, type="phylogram", direction="rightwards",
plot=TRUE, ...)
## S3 method for class 'contMap'
plot(x, ...)
errorbar.contMap(obj, ...)
tree |
object of class |
x |
a numerical vector of phenotypic trait values for species. |
res |
resolution for gradient plotting. Larger numbers (to a point) indicate a finer (smoother) gradient. |
fsize |
relative font size - can be a vector of length 2 in which the first element gives the font size for the tip labels & the second element giving the font size for the legend. |
ftype |
font type - see options in |
lwd |
line width for branches. Can be a single integer number or a vector. In the latter case, the second number will be taken to be the desired legend width. |
legend |
if |
lims |
range for the color map. By default, this will be |
outline |
logical value indicating whether or not to outline the branches of the tree in black. |
sig |
the number of decimal places to show on the legend limits. |
type |
type of plot desired. Options are |
direction |
plotting direction for |
plot |
logical value indicating whether or not to plot the tree. If |
obj |
object of class |
... |
optional arguments for |
Function plots a tree with a mapped continuous character.
The mapping is accomplished by estimating states at internal nodes using ML with fastAnc
, and then interpolating the states along each edge using equation [2] of Felsenstein (1985). This makes these interpolated values equal to the maximum likelihood estimates under a Brownian evolutionary process.
The default color palette is not recommended as it is not colorblind friendly and does not render well into gray scale; however, this can be updated using the helper function setMap
.
errorbar.contMap
adds error bars to an existing plot.
Plots a tree. An object of class "contMap"
is returned invisibly.
errorbar.contMap
adds colorful error bars to a plotted tree.
Liam Revell liam.revell@umb.edu
Felsenstein, J. (1985) Phylogenies and the comparative method. American Naturalist, 125, 1-15.
Revell, L. J. (2013) Two new graphical methods for mapping trait evolution on phylogenies. Methods in Ecology and Evolution, 4, 754-759.
Revell, L. J. (2014) Graphical methods for visualizing comparative data on phylogenies. Chapter 4 in Modern phylogenetic comparative methods and their application in evolutionary biology: Concepts and practice (L. Z. Garamszegi ed.), pp. 77-103.
Revell, L. J. (2024) phytools 2.0: an updated R ecosystem for phylogenetic comparative methods (and other things). PeerJ, 12, e16505.
Revell, L. J., K. Schliep, E. Valderrama, and J. E. Richardson (2018) Graphs in phylogenetic comparative analysis: Anscombe's quartet revisited. Methods in Ecology and Evolution, 9, 2145-2154.
anc.ML
, densityMap
, fastAnc
, plotSimmap
## load data from Garland et al. (1992)
data(mammal.tree)
data(mammal.data)
## extract character of interest
ln.bodyMass<-log(setNames(mammal.data$bodyMass,
rownames(mammal.data)))
## create "contMap" object
mammal.contMap<-contMap(mammal.tree,
ln.bodyMass,plot=FALSE,res=200)
## change color scheme
mammal.contMap<-setMap(mammal.contMap,
c("white","#FFFFB2","#FECC5C","#FD8D3C",
"#E31A1C"))
plot(mammal.contMap,fsize=c(0.7,0.8),
leg.txt="log(body mass)")
par(mar=c(5.1,4.1,4.1,2.1)) ## reset margins to default
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.