]> git.donarmstrong.com Git - ape.git/blobdiff - R/plot.phylo.R
a few bug fixes especially in plot.phylo()
[ape.git] / R / plot.phylo.R
index df246bd7399787afb9294fcf3e7d5f029889142e..69f08660f1afa189e9461ed00f51b330d78baf71 100644 (file)
@@ -1,8 +1,8 @@
-## plot.phylo.R (2010-08-12)
+## plot.phylo.R (2011-02-11)
 
 ##   Plot Phylogenies
 
-## Copyright 2002-2010 Emmanuel Paradis
+## Copyright 2002-2011 Emmanuel Paradis
 
 ## This file is part of the R-package `ape'.
 ## See the file ../COPYING for licensing issues.
@@ -359,9 +359,13 @@ plot.phylo <- function(x, type = "phylogram", use.edge.length = TRUE,
                 srt <- 180*XY$axe/pi
                 srt[as.logical(adj)] <- srt[as.logical(adj)] - 180
                 ## `srt' takes only a single value, so can't vectorize this:
+                ## (and need to 'elongate' these vectors:)
+                font <- rep(font, length.out = Ntip)
+                tip.color <- rep(tip.color, length.out = Ntip)
+                cex <- rep(cex, length.out = Ntip)
                 for (i in 1:Ntip)
-                  text(xx[i], yy[i], cex = cex, x$tip.label[i], adj = adj[i],
-                       font = font, srt = srt[i], col = tip.color[i])
+                  text(xx[i], yy[i], cex = cex[i], x$tip.label[i], adj = adj[i],
+                       font = font[i], srt = srt[i], col = tip.color[i])
             }
         }
         if (type %in% c("fan", "radial")) {
@@ -373,8 +377,12 @@ plot.phylo <- function(x, type = "phylogram", use.edge.length = TRUE,
             adj <- numeric(Ntip)
             adj[xx.tips < 0] <- 1
             ## `srt' takes only a single value, so can't vectorize this:
+            ## (and need to 'elongate' these vectors:)
+            font <- rep(font, length.out = Ntip)
+            tip.color <- rep(tip.color, length.out = Ntip)
+            cex <- rep(cex, length.out = Ntip)
             for (i in 1:Ntip)
-                text(xx[i], yy[i], x$tip.label[i], font = font, cex = cex,
+                text(xx[i], yy[i], x$tip.label[i], font = font[i], cex = cex[i],
                      srt = angle[i], adj = adj[i], col = tip.color[i])
         }
     }