1 ## subtreeplot.R (2008-04-30)
3 ## Zoom on a Portion of a Phylogeny by Successive Clicks
5 ## Copyright 2008 Damien de Vienne
7 ## This file is part of the R-package `ape'.
8 ## See the file ../COPYING for licensing issues.
10 subtreeplot<-function(x, wait=FALSE, ...) {
12 sub<-subtrees(x, wait=wait)
14 plot.default(0, type="n",axes=FALSE, ann=FALSE)
18 if (is.null(y)) plot(x,...)
19 else plot(y,sub=paste("Node :", click),...)
21 plot(x,sub="Complete tree",main="Type ESC or right click to exit", cex.main=0.9, ...)
26 coor<-plotPhyloCoor(x)
29 if (is.null(x$node.label)) nodes<-(N.tip+1):(N.tip+N.node)
30 labs<-c(rep("",N.tip), nodes)
32 click<-identify(coor[,1], coor[,2], labels=labs, n=1)
33 if (length(click) == 0) {return(y)}
35 close.screen(c(1,2),all.screens = TRUE)
37 screen(1) #selects the screen to plot in
38 plot(x, sub="Complete tree", ...) # plots x in screen 1 (left)
40 for (i in 1:length(sub)) if (sub[[i]]$name==click) break
43 else cat("this is a tip, you have to choose a node\n")