]> git.donarmstrong.com Git - ape.git/blob - man/cophyloplot.Rd
fixing various bugs + news in cophyloplot
[ape.git] / man / cophyloplot.Rd
1 \name{cophyloplot}
2 \alias{cophyloplot}
3 \title{Plots two phylogenetic trees face to face with links between the tips.}
4 \description{
5   This function plots two trees face to face with the links if specified. It is possible to rotate the branches of each tree around the nodes by clicking.
6 }
7 \usage{
8 cophyloplot(x, y, assoc = NULL, use.edge.length = FALSE, space = 0,
9        length.line = 1, gap = 2, type = "phylogram", rotate = FALSE,
10        col = par("fg"), lwd = par("lwd"), lty = par("lty"),
11        show.tip.label = TRUE, font = 3, \dots)
12 }
13
14 \arguments{
15   \item{x, y}{two objects of class \code{"phylo"}.}
16   \item{assoc}{a matrix with 2 columns specifying the associations
17     between the tips. If NULL, no links will be drawn.}
18   \item{use.edge.length}{a logical indicating whether the branch lengths
19     should be used to plot the trees; default is FALSE.}
20   \item{space}{a positive value that specifies the distance between the
21     two trees.}
22   \item{length.line}{a positive value that specifies the length of the
23     horizontal line associated to each taxa. Default is 1.}
24   \item{gap}{a value specifying the distance between the tips of the
25     phylogeny and the lines.}
26   \item{type}{a character string specifying the type of phylogeny to be
27     drawn; it must be one of "phylogram" (the default) or "cladogram".}
28   \item{rotate}{a logical indicating whether the nodes of the phylogeny
29     can be rotated by clicking. Default is FALSE.}
30   \item{col}{a character vector indicating the color to be used for the
31     links; recycled as necessary.}
32   \item{lwd}{id. for the width.}
33   \item{lty}{id. for the line type.}
34   \item{show.tip.label}{a logical indicating whether to show the tip
35     labels on the phylogeny (defaults to 'TRUE', i.e. the labels are
36     shown).}
37   \item{font}{an integer specifying the type of font for the
38     labels: 1 (plain text), 2 (bold), 3 (italic, the default), or 4
39     (bold italic).}
40   \item{\dots}{(unused)}
41 }
42 \details{
43 The aim of this function is to plot simultaneously two phylogenetic trees with associated taxa. The two trees do not necessarily have the same number of tips and more than one tip in one phylogeny can be associated with a tip in the other.
44
45 The association matrix used to draw the links has to be a matrix with two columns containing the names of the tips. One line in the matrix represents one link on the plot. The first column of the matrix has to contain tip labels of the first tree (\code{phy1}) and the second column of the matrix, tip labels of the second tree (\code{phy2}). There is no limit (low or high) for the number of lines in the matrix. A matrix with two colums and one line will give a plot with one link.
46
47 Arguments \code{gap}, \code{length.line} and \code{space} have to be changed to get a nice plot of the two phylogenies. Note that the function takes into account the length of the character strings corresponding to the names at the tips, so that the lines do not overwrite those names.
48
49 The \code{rotate} argument can be used to transform both phylogenies in order to get the more readable plot (typically by decreasing the number of crossing lines). This can be done by clicking on the nodes. The escape button or right click take back to the console.
50 }
51 \author{Damien de Vienne \email{damien.de-vienne@u-psud.fr}}
52 \seealso{
53   \code{\link{plot.phylo}}, \code{\link{rotate}}
54 }
55 \examples{
56 #two random trees
57 tree1<-rtree(40) #random tree with 40 leaves
58 tree2<-rtree(20) #random tree with 20 leaves
59
60 #creation of the association matrix
61 association<-matrix(ncol=2, nrow=40)
62 association[,1]<-association[,2]<-tree2$tip.label
63
64 #plot
65 cophyloplot(tree1, tree2, assoc=association, length.line=4, space=28, gap=3)
66
67 #plot with rotations
68 \dontrun{
69 cophyloplot(tree1, tree2, assoc=association, length.line=4, space=28, gap=3, rotate=TRUE)
70 }
71 }
72 \keyword{hplot}