Learn R Programming

BAMMtools (version 2.1.0)

cohorts: Visualize macroevolutionary cohorts

Description

Plots the matrix of pairwise correlations in rate regimes between all tips in a phylogeny

Usage

cohorts(x, ephy, col, pal, lwd = 1, ofs = 0, use.plot.bammdata = FALSE, 
			useraster = FALSE, LARGE = 500,...)

Arguments

x
a matrix of pairwise correlations generated by getCohortMatrix.
ephy
an object of class bammdata.
col
a vector of colors passed to the function image. These will be used to color the values in x. See documentation for image.
pal
the palette to use if use.plot.bammdata=TRUE. See options documented in the help file for plot.bammdata.
lwd
a numeric indicating the width of branches in the phylogeny.
ofs
a numeric controlling the offset of the phylogeny from the matrix plot. Appropriate values will probably be in the interval [0,0.1].
use.plot.bammdata
logical. should a phylorate plot be generated?
useraster
a logical indicating whether the function image should plot the matrix as a raster.
LARGE
an integer. If trees have more tips than LARGE, useraster will be coerced to TRUE.
...
further arguments passed to plot.bammdata if use.plot.bammdata=TRUE

Details

The plotting function creates an image of the BAMM correlation matrix between tip lineages of the phylogeny. Each correlation is the posterior frequency with which a pair of lineages occurs in the same macroevolutionary rate regime. Correlations are mapped to a set of colors, with warmer colors corresponding to higher correlations than cooler colors. The set of colors is specified by the col argument and a legend is plotted to guide interpretation of the color-correlation map. Trees are plotted on the margins of the matrix image. The correlation between any two tips can be inferred by finding their intersection within the matrix image.

IMPORTANT: the legend DOES NOT apply to the phylorate plots shown in the margin if use.plot.bammdata=TRUE.

See Also

plot.bammdata, getCohortMatrix, image

Examples

Run this code
library(BAMMtools)
data(whales, events.whales)
ed <- getEventData(whales, events.whales, burnin=0.1, nsamples=500)
x <- getCohortMatrix(ed)
cohorts(x, ed)
cohorts(x, ed, col=richColors(64))
cohorts(x, ed, ofs=0.05, col=richColors(64))
cohorts(x, ed, pal="temperature", col=richColors(64))
# gray scale
cohorts(x, ed, col=gray(seq(0.2,0.9,length.out=128)), use.plot.bammdata=FALSE)

Run the code above in your browser using DataLab