Learn R Programming

phytools (version 2.1-1)

phylo.heatmap: Creates a phylogenetic heat map

Description

Multivariate phylogenetic heatmap plot.

Usage

phylo.heatmap(tree, X, fsize=1, colors=NULL, standardize=FALSE, ...)

Value

Function creates a plot.

Arguments

tree

an object of class "phylo".

X

a matrix containing data for multiple continuous characters in which rownames correspond to the tip labels of the tree.

fsize

an integer or vector of length 3 containing the font size for the tip labels, the trait labels, and the legend text. (If a single integer is supplied, then the value will be recycled.)

colors

a vector of colors to be passed to image. Can be a function call (e.g., heat.colors(n= 200)[200:1]).

standardize

a logical value indicating whether or not to standardize each column of X to have the same variance & mean prior to analysis.

...

optional arguments. So far these include: legend, a logical value indicating whether or not to plot a figure legend (defaults to legend=TRUE); labels, a logical value indicating whether or not to plot trait labels (defaults to labels=TRUE); split, a numeric vector indicating the fraction of the horizontal dimension to use for the tree & heatmap, respectively (defaults to split=c(0.5,0.5)); xlim, ylim, & mar, defined as in par; and ftype, lwd, and pts as defined in plotSimmap.

Author

Liam Revell liam.revell@umb.edu

References

Revell, L. J. (2024) phytools 2.0: an updated R ecosystem for phylogenetic comparative methods (and other things). PeerJ, 12, e16505.

Examples

Run this code
## load data
data(anoletree)
data(anole.data)
## compute phylogenetic residuals
anole.data<-as.matrix(anole.data)
anole.resids<-cbind(anole.data[,1],
  phyl.resid(anoletree,anole.data[,1,drop=FALSE],
    anole.data[,2:ncol(anole.data)])$resid)
colnames(anole.resids)[1]<-"SVL"
## plot phylogenetic heatmap
phylo.heatmap(anoletree,anole.resids,
  split=c(0.7,0.3),fsize=c(0.4,0.8,0.8),
  standardize=TRUE,pts=FALSE)
par(mar=c(5.1,4.1,4.1,2.1)) ## reset margins to default

Run the code above in your browser using DataLab