+ if (interactive) {
+ cat("Left-click close to the tips you want to drop; right-click when finished...\n")
+ xy <- locator()
+ nToDrop <- length(xy$x)
+ tip <- integer(nToDrop)
+ lastPP <- get("last_plot.phylo", envir = .PlotPhyloEnv)
+ for (i in 1:nToDrop) {
+ d <- sqrt((xy$x[i] - lastPP$xx)^2 + (xy$y[i] - lastPP$yy)^2)
+ tip[i] <- which.min(d)
+ }
+ } else {
+ if (is.character(tip))
+ tip <- which(phy$tip.label %in% tip)
+ }
+ if (!length(tip)) return(phy)
+ if (any(tip > Ntip))
+ warning("some tip numbers were higher than the number of tips")