Last data update: 2014.03.03

R: Visualize macroevolutionary cohorts
cohortsR Documentation

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. If col = 'temperature', the color palette from rich.colors from the gplots package will be used.

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.

Author(s)

Mike Grundler

See Also

plot.bammdata, getCohortMatrix, image

Examples

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

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(BAMMtools)
Loading required package: ape
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/BAMMtools/cohorts.Rd_%03d_medium.png", width=480, height=480)
> ### Name: cohorts
> ### Title: Visualize macroevolutionary cohorts
> ### Aliases: cohorts
> 
> ### ** Examples
> 
> data(whales, events.whales)
> ed <- getEventData(whales, events.whales, burnin=0.1, nsamples=500)
Processing event data from data.frame

Discarded as burnin: GENERATIONS <  995000
Analyzing  500  samples from posterior

Setting recursive sequence on tree...

Done with recursive sequence

> x <- getCohortMatrix(ed)
> cohorts(x, ed)
> cohorts(x, ed, col='temperature')
> cohorts(x, ed, ofs=0.05, col='temperature')
> cohorts(x, ed, pal="temperature", col='temperature', use.plot.bammdata=TRUE)
> # gray scale
> cohorts(x, ed, col=gray(seq(0.2,0.9,length.out=128)),
+         use.plot.bammdata=FALSE)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>