-## nodelabels.R (2008-02-08)
+## nodelabels.R (2008-02-28)
## Labelling Trees
if (!is.null(pie)) {
if (is.vector(pie)) pie <- cbind(pie, 1 - pie)
xrad <- CEX * diff(par("usr")[1:2]) / 50
+ xrad <- rep(xrad, length(sel))
for (i in 1:length(sel))
floating.pie.asp(XX[i], YY[i], pie[i, ],
- radius = xrad, col = piecol)
+ radius = xrad[i], col = piecol)
}
if (!is.null(text)) text(XX, YY, text, adj = adj, col = col, ...)
if (!is.null(pch)) points(XX + adj[1] - 0.5, YY + adj[2] - 0.5,
pch = NULL, thermo = NULL, pie = NULL, piecol = NULL,
col = "black", bg = "lightblue", ...)
{
- xx <- get("last_plot.phylo$xx", envir = .PlotPhyloEnv)
- yy <- get("last_plot.phylo$yy", envir = .PlotPhyloEnv)
- if (missing(node))
- node <- (get("last_plot.phylo$Ntip",
- envir = .PlotPhyloEnv) + 1):length(xx)
- XX <- xx[node]
- YY <- yy[node]
+ lastPP <- get("last_plot.phylo", envir = .PlotPhyloEnv)
+ if (missing(node)) node <- (lastPP$Ntip + 1):length(lastPP$xx)
+ XX <- lastPP$xx[node]
+ YY <- lastPP$yy[node]
BOTHlabels(text, node, XX, YY, adj, frame, pch, thermo,
pie, piecol, col, bg, ...)
}
pch = NULL, thermo = NULL, pie = NULL, piecol = NULL,
col = "black", bg = "yellow", ...)
{
- if (missing(tip))
- tip <- 1:get("last_plot.phylo$Ntip", envir = .PlotPhyloEnv)
- XX <- get("last_plot.phylo$xx", envir = .PlotPhyloEnv)[tip]
- YY <- get("last_plot.phylo$yy", envir = .PlotPhyloEnv)[tip]
+ lastPP <- get("last_plot.phylo", envir = .PlotPhyloEnv)
+ if (missing(tip)) tip <- 1:lastPP$Ntip
+ XX <- lastPP$xx[tip]
+ YY <- lastPP$yy[tip]
BOTHlabels(text, tip, XX, YY, adj, frame, pch, thermo,
pie, piecol, col, bg, ...)
}
pch = NULL, thermo = NULL, pie = NULL, piecol = NULL,
col = "black", bg = "lightgreen", ...)
{
- xx <- get("last_plot.phylo$xx", envir = .PlotPhyloEnv)
- yy <- get("last_plot.phylo$yy", envir = .PlotPhyloEnv)
- lastEdge <- get("last_plot.phylo$edge", envir = .PlotPhyloEnv)
+ lastPP <- get("last_plot.phylo", envir = .PlotPhyloEnv)
if (missing(edge)) {
- sel <- 1:dim(lastEdge)[1]
- subedge <- lastEdge
+ sel <- 1:dim(lastPP$edge)[1]
+ subedge <- lastPP$edge
} else {
sel <- edge
- subedge <- lastEdge[sel, , drop = FALSE]
+ subedge <- lastPP$edge[sel, , drop = FALSE]
}
- if (get("last_plot.phylo$type", envir = .PlotPhyloEnv) == "phylogram") {
- if(get("last_plot.phylo$direction", envir = .PlotPhyloEnv)
- %in% c("rightwards", "leftwards")) {
- XX <- (xx[subedge[, 1]] + xx[subedge[, 2]]) / 2
- YY <- yy[subedge[, 2]]
+ if (lastPP$type == "phylogram") {
+ if (lastPP$direction %in% c("rightwards", "leftwards")) {
+ XX <- (lastPP$xx[subedge[, 1]] + lastPP$xx[subedge[, 2]]) / 2
+ YY <- lastPP$yy[subedge[, 2]]
} else {
- XX <- xx[subedge[, 2]]
- YY <- (yy[subedge[, 1]] + yy[subedge[, 2]]) / 2
+ XX <- lastPP$xx[subedge[, 2]]
+ YY <- (lastPP$yy[subedge[, 1]] + lastPP$yy[subedge[, 2]]) / 2
}
} else {
- XX <- (xx[subedge[, 1]] + xx[subedge[, 2]]) / 2
- YY <- (yy[subedge[, 1]] + yy[subedge[, 2]]) / 2
+ XX <- (lastPP$xx[subedge[, 1]] + lastPP$xx[subedge[, 2]]) / 2
+ YY <- (lastPP$yy[subedge[, 1]] + lastPP$yy[subedge[, 2]]) / 2
}
BOTHlabels(text, sel, XX, YY, adj, frame, pch, thermo,
pie, piecol, col, bg, ...)