1 ## plot.popsize.R (2004-07-4)
3 ## Plot population size in dependence of time
5 ## Copyright 2004 Rainer Opgen-Rhein and Korbinian Strimmer
7 ## This file is part of the R-package `ape'.
8 ## See the file ../COPYING for licensing issues.
10 plot.popsize <- function(x, show.median=TRUE,
11 show.years=FALSE, subst.rate, present.year, ...)
13 if (class(x) != "popsize")
14 stop("object \"x\" is not of class \"popsize\"")
16 ylim <- c(min(popsize[,2:5]),max(popsize[,2:5]))
19 x1 <- -x[,1]/subst.rate+present.year
20 xlab <- "time (years)"
21 xlim <- c(min(x1),max(x1))
26 xlab <- "time (past to present in units of substitutions)"
27 xlim <- c(max(x1),min(x1))
31 plot(x1,x[,3],type="s", xlim=xlim, ylim=ylim, xlab=xlab,ylab="effective population size",log="y", lwd=2.5, ...) #median
33 plot(x1,x[,2],type="s", xlim=xlim, ylim=ylim, xlab=xlab,ylab="effective population size",log="y", lwd=2.5, ...) #median
41 lines.popsize <- function(x, show.median=TRUE,
42 show.years=FALSE, subst.rate, present.year, ...)
44 if (class(x) != "popsize")
45 stop("object \"x\" is not of class \"popsize\"")
49 x1 <- -x[,1]/subst.rate+present.year
58 lines(x1,x[,3], lwd=2.5, ...) #median
60 lines(x1,x[,2], lwd=2.5, ...) #median