Learn R Programming

phytools (version 1.2-0)

cophylo: Creates a co-phylogenetic plot

Description

This function creates an object of class "cophylo" or, in the case of plot.cophylo, plots that object. The function can (optionally) first attempt to rotate the nodes of both trees to optimize vertical matching of tips.

cotangleplot creates a co-phylogenetic plot in which the edges of the matched trees are crossing.

Usage

cophylo(tr1, tr2, assoc=NULL, rotate=TRUE, ...)
# S3 method for cophylo
plot(x, ...)
cotangleplot(tr1, tr2, type=c("cladogram","phylogram"),
	use.edge.length=TRUE, tangle=c("both","tree1","tree2"), ...)

Value

An object of class "cophylo" which includes the following components or a pair of plotted facing phylogenies with links between tips as specified in assoc.

Arguments

tr1

object of class "phylo".

tr2

object of class "phylo".

assoc

matrix containing the tip labels in tr1 to match to the tip labels in tr2. Note that not all labels in either tree need to be included; and, furthermore, one label in tr1 can be matched with more than one label in tr2, or vice versa.

rotate

logical argument indicating whether nodes on both trees should be rotated to attempt to match in vertical position.

x

in the case of plot.cophylo, an object of class "cophylo" to be plotted.

type

for cotangleplot, the tree plotting style.

use.edge.length

for cotangleplot, a logical value indicating whether or not to plot trees with edge lengths.

tangle

for cotangleplot, whether to tangle the left tree, the right tree, or both.

...

optional arguments to be passed to tipRotate, or, in the case of plot.cophylo, to the internally used tree plotting function, phylogram. phylogram takes similar arguments to plotSimmap, such as fsize, ftype, lwd, and pts, though not all options from plotSimmap and plotTree are available. If fsize is supplied as a vector, different size fonts for the left & right facing trees may be used. In addition, the optional argument scale.bar, which should be a vector containing the lengths of the scale bars desired for the right & left trees, will add scale bars to the plot when supplied to plot.cophylo. If either tree contains polytomies, the cophylo argument rotate.multi should be set to TRUE. If curved linking lines are desired, the plot.cophylo argument link.type should be set to "curved". Other arguments for the plot method include link.col, link.lty, and link.lwd, which can be supplied as a scalar or a vector in which the order of the elements corresponds to the order of the associations in assoc. Finally, edge.col, a list consisting of two vectors (left and right) can be used to specify the edge colors of the two left & right plotted trees. Note that the edge order is the same as in the rotated trees, assuming that a rotation has been performed on x.

Author

Liam Revell liam.revell@umb.edu

Details

If no matrix of associations, assoc, is provided, then cophylo will look for exact matches of tip labels between trees.

References

Revell, L. J. (2012) phytools: An R package for phylogenetic comparative biology (and other things). Methods Ecol. Evol., 3, 217-223.

See Also

cophyloplot, plotSimmap

Examples

Run this code
## load data from Lopez-Vaamonde et al. (2001)
data(wasp.trees)
data(wasp.data)
## create co-phylogenetic object
wasp.cophylo<-cophylo(wasp.trees[[1]],wasp.trees[[2]],
    assoc=wasp.data)
## plot co-phylogenies
plot(wasp.cophylo,link.type="curved",link.lwd=4,
     link.lty="solid",link.col=make.transparent("red",
     0.25))
par(mar=c(5.1,4.1,4.1,2.1))

Run the code above in your browser using DataLab