]> git.donarmstrong.com Git - ape.git/commitdiff
new option 'draw' in plot.phylo()
authorparadis <paradis@6e262413-ae40-0410-9e79-b911bd7a66b7>
Tue, 29 Mar 2011 09:19:17 +0000 (09:19 +0000)
committerparadis <paradis@6e262413-ae40-0410-9e79-b911bd7a66b7>
Tue, 29 Mar 2011 09:19:17 +0000 (09:19 +0000)
git-svn-id: https://svn.mpl.ird.fr/ape/dev/ape@155 6e262413-ae40-0410-9e79-b911bd7a66b7

ChangeLog
DESCRIPTION
R/plot.phylo.R
man/plot.phylo.Rd

index 40d2a9549737beaae4fd14e5a894e38faa5f0b35..c702b68074489aa961044ce2efd6819da03b96c4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+               CHANGES IN APE VERSION 2.7-2
+
+
+NEW FEATURES
+
+    o plot.phylo() has a new option 'draw = TRUE'. If FALSE, the tree
+      is not plotted but the graphical device is set and the
+      coordinates are saved as normal.
+
+
+
                CHANGES IN APE VERSION 2.7-1
 
 
index 6da064ba81c6cd7dca80f2e53544c620b7d23351..90bd55b06ef6d17c998ecedd96c1383004fb0254 100644 (file)
@@ -1,6 +1,6 @@
 Package: ape
-Version: 2.7-1
-Date: 2011-03-26
+Version: 2.7-2
+Date: 2011-03-29
 Title: Analyses of Phylogenetics and Evolution
 Author: Emmanuel Paradis, Ben Bolker, Julien Claude, Hoa Sien Cuong, Richard Desper, Benoit Durand, Julien Dutheil, Olivier Gascuel, Christoph Heibl, Daniel Lawson, Vincent Lefort, Pierre Legendre, Jim Lemon, Yvonnick Noel, Johan Nylander, Rainer Opgen-Rhein, Klaus Schliep, Korbinian Strimmer, Damien de Vienne
 Maintainer: Emmanuel Paradis <Emmanuel.Paradis@ird.fr>
index 18bba88509dd0bab1e37b91d3b274c26a6aee316..88380ff269d9b8cd3d61adc18dbde7cdd4d456ff 100644 (file)
@@ -1,4 +1,4 @@
-## plot.phylo.R (2011-03-23)
+## plot.phylo.R (2011-03-29)
 
 ##   Plot Phylogenies
 
@@ -7,14 +7,15 @@
 ## This file is part of the R-package `ape'.
 ## See the file ../COPYING for licensing issues.
 
-plot.phylo <- function(x, type = "phylogram", use.edge.length = TRUE,
-                       node.pos = NULL, show.tip.label = TRUE,
-                       show.node.label = FALSE, edge.color = "black",
-                       edge.width = 1, edge.lty = 1, font = 3, cex = par("cex"),
-                       adj = NULL, srt = 0, no.margin = FALSE,
-                       root.edge = FALSE, label.offset = 0, underscore = FALSE,
-                       x.lim = NULL, y.lim = NULL, direction = "rightwards",
-                       lab4ut = "horizontal", tip.color = "black", ...)
+plot.phylo <-
+    function(x, type = "phylogram", use.edge.length = TRUE,
+             node.pos = NULL, show.tip.label = TRUE,
+             show.node.label = FALSE, edge.color = "black",
+             edge.width = 1, edge.lty = 1, font = 3, cex = par("cex"),
+             adj = NULL, srt = 0, no.margin = FALSE, root.edge = FALSE,
+             label.offset = 0, underscore = FALSE, x.lim = NULL,
+             y.lim = NULL, direction = "rightwards", lab4ut = "horizontal",
+             tip.color = "black", draw = TRUE, ...)
 {
     Ntip <- length(x$tip.label)
     if (Ntip == 1) {
@@ -278,6 +279,8 @@ plot.phylo <- function(x, type = "phylogram", use.edge.length = TRUE,
     }
     asp <- if (type %in% c("fan", "radial", "unrooted")) 1 else NA # fixes by Klaus Schliep (2008-03-28 and 2010-08-12)
     plot(0, type = "n", xlim = x.lim, ylim = y.lim, ann = FALSE, axes = FALSE, asp = asp, ...)
+
+if (draw) {
     if (is.null(adj))
         adj <- if (phyloORclado && direction == "leftwards") 1 else 0
     if (phyloORclado && show.tip.label) {
@@ -288,7 +291,7 @@ plot.phylo <- function(x, type = "phylogram", use.edge.length = TRUE,
         }
         if (direction == "leftwards") {
             lox <- -label.offset - MAXSTRING * 1.05 * (1 - adj)
-            #xx <- xx + MAXSTRING
+            ##xx <- xx + MAXSTRING
         }
         if (!horizontal) {
             psr <- par("usr")
@@ -403,6 +406,7 @@ plot.phylo <- function(x, type = "phylogram", use.edge.length = TRUE,
     if (show.node.label)
         text(xx[ROOT:length(xx)] + label.offset, yy[ROOT:length(yy)],
              x$node.label, adj = adj, font = font, srt = srt, cex = cex)
+}
     L <- list(type = type, use.edge.length = use.edge.length,
               node.pos = node.pos, show.tip.label = show.tip.label,
               show.node.label = show.node.label, font = font,
index f6a137cc3fbb9d3372d3df7d807c1266c274a753..2a07ba0c5726429286c1fe45d2371537fb555f75 100644 (file)
@@ -9,7 +9,7 @@
     cex = par("cex"), adj = NULL, srt = 0, no.margin = FALSE,
     root.edge = FALSE, label.offset = 0, underscore = FALSE,
     x.lim = NULL, y.lim = NULL, direction = "rightwards",
-    lab4ut = "horizontal", tip.color = "black", ...)
+    lab4ut = "horizontal", tip.color = "black", draw = TRUE, ...)
 \method{plot}{multiPhylo}(x, layout = 1, ...)
 }
 \arguments{
@@ -90,6 +90,9 @@
     \code{type = "unrooted"}.}
   \item{tip.color}{the colours used for the tip labels, eventually
     recycled (see examples).}
+  \item{draw}{a logical controlling whether to draw the tree. If
+    \code{FALSE}, the graphical device is set as if the tree was
+    plotted, and the coordinates are saved as well.}
   \item{layout}{the number of trees to be plotted simultaneously.}
   \item{\dots}{further arguments to be passed to \code{plot} or to
     \code{plot.phylo}.}