]> git.donarmstrong.com Git - ape.git/blob - man/ltt.plot.Rd
current 2.1 release
[ape.git] / man / ltt.plot.Rd
1 \name{ltt.plot}
2 \alias{ltt.plot}
3 \alias{ltt.lines}
4 \alias{mltt.plot}
5 \title{Lineages Through Time Plot}
6 \usage{
7 ltt.plot(phy, xlab = "Time", ylab = "N", ...)
8 ltt.lines(phy, ...)
9 mltt.plot(phy, ..., dcol = TRUE, dlty = FALSE,
10           legend = TRUE, xlab = "Time", ylab = "N")
11 }
12 \arguments{
13   \item{phy}{an object of class \code{"phylo"}; this could be an object
14     of class \code{"multiPhylo"} in the case of \code{mltt.plot}.}
15   \item{xlab}{a character string (or a variable of mode character)
16     giving the label for the x-axis (default is "Time").}
17   \item{ylab}{idem for the y-axis (default is "N").}
18   \item{...}{in the cases of \code{ltt.plot()} and \code{ltt.lines()}
19     these are further (graphical) arguments to be passed to
20     \code{plot()} or \code{lines()}, respectively (see \code{Details:}
21     on how to transform the axes); in the case \code{mltt.plot()} these
22     are additional trees to be plotted (see \code{Details:}).}
23   \item{dcol}{a logical specifying whether the different curves should
24     be differentiated with colors (default is \code{TRUE}).}
25   \item{dlty}{a logical specifying whether the different curves should
26     be differentiated with patterns of dots and dashes (default is
27     \code{FALSE}).}
28   \item{legend}{a logical specifying whether a legend should be
29     plotted.}
30 }
31 \description{
32   These functions plot, on the current graphical device, the minimum
33   numbers of lineages through time from phylogenetic trees.
34 }
35 \details{
36   \code{ltt.plot} does a simple lineages through time (LTT)
37   plot. Additional arguments (\code{...}) may be used to change, for
38   instance, the limits on the axes (with \code{xlim} and/or
39   \code{ylim}) or other graphical settings (\code{col} for the color,
40   \code{lwd} for the line thickness, \code{lty} for the line type may be
41   useful; see \code{\link[graphics]{par}} for an exhaustive listing of
42   graphical parameters). The \eqn{y}-axis can be log-transformed by
43   adding the following option: \code{log = "y"}.
44
45   \code{ltt.lines} adds a LTT curve to an existing plot. Additional
46   arguments (\code{...}) may be used to change the settings of the added
47   line. Of course, the settings of the already existing LTT plot cannot
48   be altered this way.
49
50   \code{mltt.plot} does a multiple LTT plot taking as arguments one or
51   several trees. These trees may be given as objects of class
52   \code{"phylo"} (single trees) or \code{"multiPhylo"} (multiple
53   trees). Any number of objects may be given. This function is mainly
54   for exploratory analyses with the advantages that the axes are set
55   properly to view all lines, and the legend is plotted by default. For
56   more flexible settings of line drawings, it is probably better to
57   combine \code{ltt.plot()} with successive calls of \code{ltt.lines()}
58   (see \code{Examples:}).
59 }
60 \references{
61   Harvey, P. H., May, R. M. and Nee, S. (1994) Phylogenies without
62   fossils. \emph{Evolution}, \bold{48}, 523--529.
63
64   Nee, S., Holmes, E. C., Rambaut, A. and Harvey, P. H. (1995) Inferring
65   population history from molecular phylogenies. \emph{Philosophical
66     Transactions of the Royal Society of London. Series B. Biological
67     Sciences}, \bold{349}, 25--31.
68 }
69 \author{Emmanuel Paradis \email{Emmanuel.Paradis@mpl.ird.fr}}
70 \seealso{
71   \code{\link{skyline}}, \code{\link{branching.times}},
72   \code{\link{birthdeath}}, \code{\link{bd.ext}}, \code{\link{yule.cov}}
73   \code{\link[graphics]{plot}} for the basic plotting function in R
74 }
75 \examples{
76 data(bird.families)
77 data(bird.orders)
78 opar <- par(mfrow = c(2, 1))
79 ltt.plot(bird.families)
80 title("Lineages Through Time Plot of the Bird Families")
81 ltt.plot(bird.families, log = "y")
82 title(main = "Lineages Through Time Plot of the Bird Families",
83       sub = "(with logarithmic transformation of the y-axis)")
84 par(opar)
85 ### to plot the tree and the LTT plot together
86 layout(matrix(1:4, 2, 2))
87 plot(bird.families, show.tip.label = FALSE)
88 ltt.plot(bird.families, main = "Bird families")
89 plot(bird.orders, show.tip.label = FALSE)
90 ltt.plot(bird.orders, main = "Bird orders")
91 layout(matrix(1))
92 mltt.plot(bird.families, bird.orders)
93 ### Generates 10 random trees with 23 tips:
94 TR <- replicate(10, rcoal(23), FALSE)
95 ### Give names to each tree:
96 names(TR) <- paste("random tree", 1:10)
97 ### And specify the class of the list so that mltt.plot()
98 ### does not trash it!
99 class(TR) <- "multiPhylo"
100 mltt.plot(TR, bird.orders)
101 ### And now for something (not so) completely different:
102 ltt.plot(bird.orders, lwd = 2)
103 for (i in 1:10) ltt.lines(TR[[i]], lty = 2)
104 legend(-10, 5, lwd = c(2, 1), lty = c(1, 2), bty = "n",
105        legend = c("Bird orders", "Random trees"))
106 }
107 \keyword{hplot}
108 \keyword{aplot}