3 ## Zoom on a Portion of a Phylogeny
5 ## Copyright 2003-2009 Emmanuel Paradis
7 ## This file is part of the R-package `ape'.
8 ## See the file ../COPYING for licensing issues.
10 zoom <- function(phy, focus, subtree = FALSE, col = rainbow, ...)
12 if (!is.list(focus)) focus <- list(focus)
15 if (is.character(focus[[i]]))
16 focus[[i]] <- which(phy$tip.label %in% focus[[i]]) # fix by Yan Wong
17 if (is.function(col)) {
18 col <- if (deparse(substitute(col)) == "grey") grey(1:n/n) else col(n)
20 ext <- vector("list", n)
22 ext[[i]] <- drop.tip(phy, phy$tip.label[-focus[[i]]],
23 subtree = subtree, rooted = TRUE)
24 nc <- round(sqrt(n)) + 1
25 nr <- ceiling(sqrt(n))
26 M <- matrix(0, nr, nc)
27 x <- c(rep(1, nr), 2:(n + 1))
29 layout(M, c(1, rep(3/(nc - 1), nc - 1)))
30 phy$tip.label <- rep("", length(phy$tip.label))
31 colo <- rep("black", dim(phy$edge)[1])
33 colo[which.edge(phy, focus[[i]])] <- col[i]
34 plot.phylo(phy, edge.color = colo, ...)
36 plot.phylo(ext[[i]], edge.color = col[i], ...)