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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jul 20 16:14:08 CEST 2010


Author: jarioksa
Date: 2010-07-20 16:14:08 +0200 (Tue, 20 Jul 2010)
New Revision: 1242

Modified:
   pkg/vegan/R/ordiellipse.R
   pkg/vegan/inst/ChangeLog
Log:
ordiellipse used the same colour to fill and label the polygon

Modified: pkg/vegan/R/ordiellipse.R
===================================================================
--- pkg/vegan/R/ordiellipse.R	2010-07-20 05:59:48 UTC (rev 1241)
+++ pkg/vegan/R/ordiellipse.R	2010-07-20 14:14:08 UTC (rev 1242)
@@ -28,6 +28,8 @@
     out <- seq(along = groups)
     inds <- names(table(groups))
     res <- list()
+    if (label)
+        cntrs <- names <- NULL
     for (is in inds) {
         gr <- out[groups == is]
         if (length(gr) > 2) {
@@ -44,13 +46,21 @@
                 ordiArgAbsorber(xy, FUN = lines, ...)
             else if (draw == "polygon") 
                 ordiArgAbsorber(xy[, 1], xy[, 2], FUN = polygon, ...)
-            if (label && draw != "none")
-                ordiArgAbsorber(mat$center[1], mat$center[2], labels=is,
-                               FUN = text, ...)
+            if (label && draw != "none") {
+                cntrs <- rbind(cntrs, mat$center)
+                names <- c(names, is)
+            }
             mat$scale <- t
             res[[is]] <- mat
         }
     }
+    if (label && draw != "none") {
+        if (draw == "lines")
+            ordiArgAbsorber(cntrs[,1], cntrs[,2], labels=names, 
+                            FUN = text, ...)
+        else
+            ordiArgAbsorber(cntrs, labels = names, FUN = ordilabel, ...)
+    }
     class(res) <- "ordiellipse"
     invisible(res)
 }

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2010-07-20 05:59:48 UTC (rev 1241)
+++ pkg/vegan/inst/ChangeLog	2010-07-20 14:14:08 UTC (rev 1242)
@@ -9,6 +9,11 @@
 	plot.MOStest: uses veganCovEllipse instead of
 	ellipse:::ellipse.glm. 
 
+	ordiellipse: failed to plot labels with filled polygons, since the
+	same colour was used for polygon filling and labels. Now uses
+	ordilabel() with draw == "polygon" (but still text() with draw ==
+	"lines"). 
+
 Version 1.18-7 (closed July 19, 2010)
 
 	* new version opened with the release of vegan_1.17-3.



More information about the Vegan-commits mailing list