[Vegan-commits] r1686 - in pkg/vegan: R inst

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Jul 22 21:05:35 CEST 2011


Author: gsimpson
Date: 2011-07-22 21:05:34 +0200 (Fri, 22 Jul 2011)
New Revision: 1686

Modified:
   pkg/vegan/R/ordiplot.R
   pkg/vegan/inst/ChangeLog
Log:
handle plot.default arguments better in ordiplot

Modified: pkg/vegan/R/ordiplot.R
===================================================================
--- pkg/vegan/R/ordiplot.R	2011-07-20 13:38:02 UTC (rev 1685)
+++ pkg/vegan/R/ordiplot.R	2011-07-22 19:05:34 UTC (rev 1686)
@@ -1,13 +1,18 @@
 `ordiplot` <-
-    function (ord, choices = c(1, 2), type = "points", display, xlim, 
-              ylim, ...) 
+    function (ord, choices = c(1, 2), type = "points", display, xlim,
+              ylim, ...)
 {
-    if (!is.null(attr(ord, "class")) && (class(ord) == "decorana" || 
+    ## local functions to absorb non-par arguments of plot.default
+    localPoints <- function(..., log, frame.plot, panel.first,
+                            panel.last, axes) points(...)
+    localText <- function(..., log, frame.plot, panel.first,
+                          panel.last, axes) text(...)
+    if (!is.null(attr(ord, "class")) && (class(ord) == "decorana" ||
                                          any(class(ord) == "cca"))) {
-        if (missing(display)) 
-            out <- plot(ord, choices, type = type, xlim = xlim, 
+        if (missing(display))
+            out <- plot(ord, choices, type = type, xlim = xlim,
                         ylim = ylim, ...)
-        else out <- plot(ord, choices, type = type, display = display, 
+        else out <- plot(ord, choices, type = type, display = display,
                          xlim = xlim, ylim = ylim, ...)
     }
     else {
@@ -20,7 +25,7 @@
         else
             display <- match.arg(display, dplays, several.ok = TRUE)
         X <- Y <- NULL
-        if ("sites" %in% display) 
+        if ("sites" %in% display)
             X <- scores(ord, choices = choices, display = "sites")
         if ("species" %in% display) {
             options(show.error.messages = FALSE)
@@ -45,26 +50,23 @@
             return(invisible(pl))
         }
         tmp <- apply(rbind(X, Y), 2, range, na.rm=TRUE)
-        if (missing(xlim)) 
+        if (missing(xlim))
             xlim <- tmp[, 1]
-        if (missing(ylim)) 
+        if (missing(ylim))
             ylim <- tmp[, 2]
-        plot(tmp, xlim = xlim, ylim = ylim, asp = 1, type = "n", 
+        plot(tmp, xlim = xlim, ylim = ylim, asp = 1, type = "n",
              ...)
         if (type == "points") {
-            if (!is.null(X)) 
-                points(X, pch = 1, col = 1, cex = 0.7, ...)
-            if (!is.null(Y)) 
-                points(Y, pch = "+", col = "red", cex = 0.7, 
-                       ...)
+            if (!is.null(X))
+                localPoints(X, pch = 1, col = 1, cex = 0.7, ...)
+            if (!is.null(Y))
+                localPoints(Y, pch = "+", col = "red", cex = 0.7, ...)
         }
         if (type == "text") {
-            if (!is.null(X)) 
-                text(X, labels = rownames(X), col = 1, cex = 0.7, 
-                     ...)
-            if (!is.null(Y)) 
-                text(Y, labels = rownames(Y), col = "red", cex = 0.7, 
-                     ...)
+            if (!is.null(X))
+                localText(X, labels = rownames(X), col = 1, cex = 0.7, ...)
+            if (!is.null(Y))
+                localText(Y, labels = rownames(Y), col = "red", cex = 0.7, ...)
         }
         out <- list(sites = X, species = Y)
     }

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2011-07-20 13:38:02 UTC (rev 1685)
+++ pkg/vegan/inst/ChangeLog	2011-07-22 19:05:34 UTC (rev 1686)
@@ -13,7 +13,7 @@
 	predict.cca/rda, screeplot.cca. The following functions did not
 	fail, but were fixed: anova.ccanull, calibrate.cca, ordirgl,
 	ordiresids, ordiplot3d, deviance.cca/rda (simplified),
-	ordixyplot. 
+	ordixyplot.
 
 	* swan: gained argument 'maxit' that can be used to restrict the
 	number of beals() passes on zeros. The default is 'maxit = Inf'
@@ -45,7 +45,10 @@
 	interpretation). Remove argument 'old.wa' introduced in rev280 on
 	24/3/08 for backward compatibility when calculating WA scores
 	started to use the same transformed data as analysed.
-	 
+
+	* ordiplot: Now handles non-par arguments to plot.default without
+	warnings. Things like `axes = FALSE` in the call now just work!
+
 Version 1.90-0 (closed July 3, 2011)
 
 	* vegan now depends on the permute package for new permutation



More information about the Vegan-commits mailing list