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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Sep 20 13:45:41 CEST 2013


Author: jarioksa
Date: 2013-09-20 13:45:41 +0200 (Fri, 20 Sep 2013)
New Revision: 2621

Modified:
   pkg/vegan/R/ordilabel.R
   pkg/vegan/inst/ChangeLog
Log:
ordilabel() can use vectors of colour arguments col, fill, border

Modified: pkg/vegan/R/ordilabel.R
===================================================================
--- pkg/vegan/R/ordilabel.R	2013-09-18 18:01:03 UTC (rev 2620)
+++ pkg/vegan/R/ordilabel.R	2013-09-20 11:45:41 UTC (rev 2621)
@@ -18,6 +18,8 @@
         ord <- order(priority)
         x <- x[ord, ]
         labels <- labels[ord]
+    } else {
+        ord <- seq_along(labels)
     }
     em <- strwidth("m", cex = cex, ...)
     ex <- strheight("x", cex = cex, ...)
@@ -28,12 +30,15 @@
             col <- border
         else
             col <- par("fg")
+    col <- rep(col, length=nrow(x))[ord]
+    border <- rep(border, length=nrow(x))[ord]
+    fill <- rep(fill, length=nrow(x))[ord]
     for (i in 1:nrow(x)) {
         ordiArgAbsorber(x[i,1] + c(-1,1,1,-1)*w[i], x[i,2] + c(-1,-1,1,1)*h[i],
-                        col = fill, border = border, xpd = xpd,
+                        col = fill[i], border = border[i], xpd = xpd,
                         FUN = polygon, ...)
         ordiArgAbsorber(x[i,1], x[i,2], labels = labels[i], cex = cex,
-                        col = col, xpd = xpd, FUN = text, ...)
+                        col = col[i], xpd = xpd, FUN = text, ...)
     }
     invisible(x)
 }

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2013-09-18 18:01:03 UTC (rev 2620)
+++ pkg/vegan/inst/ChangeLog	2013-09-20 11:45:41 UTC (rev 2621)
@@ -4,6 +4,13 @@
 
 Version 2.1-35 (opened September 5, 2013)
 
+	* ordilabel: colour arguments ('col', 'fill', 'borderä) can now be
+	vectors and will be recycled if needed. May need care if used with
+	'select', but should work with 'priority'. This was needed for a
+	function under development and testing: when labelling over lines,
+	it may be nice if the border has the same colour as the line
+	covered.
+
 	* MDSrotate: can now rotate a solution to more than one vector,
 	provided that the number of dimensions is higher than the number
 	of vectors. Because fitted vectors usually are correlated, only



More information about the Vegan-commits mailing list