[Vegan-commits] r539 - in pkg: R inst

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Oct 30 12:49:58 CET 2008


Author: jarioksa
Date: 2008-10-30 12:49:58 +0100 (Thu, 30 Oct 2008)
New Revision: 539

Modified:
   pkg/R/cophenetic.spantree.R
   pkg/R/plot.spantree.R
   pkg/R/spantree.R
   pkg/inst/ChangeLog
Log:
spantree: saves point labels and uses these in 'cophenetic' and 'plot', and 'plot' uses 'ordilabel' for text

Modified: pkg/R/cophenetic.spantree.R
===================================================================
--- pkg/R/cophenetic.spantree.R	2008-10-29 10:40:10 UTC (rev 538)
+++ pkg/R/cophenetic.spantree.R	2008-10-30 11:49:58 UTC (rev 539)
@@ -7,6 +7,6 @@
     ind <- t(ind[2:1,])
     mat[ind] <- x$dist
     d <- as.dist(mat)
+    attr(d, "Labels") <- x$labels
     stepacross(d, path = "extended", toolong=0, trace=FALSE)
 }
-

Modified: pkg/R/plot.spantree.R
===================================================================
--- pkg/R/plot.spantree.R	2008-10-29 10:40:10 UTC (rev 538)
+++ pkg/R/plot.spantree.R	2008-10-30 11:49:58 UTC (rev 539)
@@ -26,8 +26,8 @@
         points(ord, cex = cex, ...)
     else if (type == "t") {
         if (missing(labels)) 
-            labels <- rownames(ord)
-        text(ord, labels = labels, cex = cex, ...)
+            labels <- x$labels
+        ordilabel(ord, display = "sites", labels = labels, cex = cex, ...)
     }
     ord <- list(sites = ord)
     class(ord) <- "ordiplot"

Modified: pkg/R/spantree.R
===================================================================
--- pkg/R/spantree.R	2008-10-29 10:40:10 UTC (rev 538)
+++ pkg/R/spantree.R	2008-10-30 11:49:58 UTC (rev 539)
@@ -3,11 +3,12 @@
 {
     dis <- as.dist(dis)
     n <- attr(dis, "Size")
+    labels <- labels(dis)
     dis <- .C("primtree", dist = as.double(dis), toolong = as.double(toolong), 
               n = as.integer(n), val = double(n + 1),
               dad = integer(n + 1), NAOK = TRUE, PACKAGE = "vegan")
-    out <- list(kid = dis$dad[2:n] + 1, dist = dis$val[2:n])
+    out <- list(kid = dis$dad[2:n] + 1, dist = dis$val[2:n],
+                labels = labels)
     class(out) <- "spantree"
     out
 }
-

Modified: pkg/inst/ChangeLog
===================================================================
--- pkg/inst/ChangeLog	2008-10-29 10:40:10 UTC (rev 538)
+++ pkg/inst/ChangeLog	2008-10-30 11:49:58 UTC (rev 539)
@@ -4,6 +4,10 @@
 
 Version 1.16-3 (opened October 27, 2008)
 
+	* spantree: saves labels of points, and 'cophenetic' and 'plot'
+	use these labels. Function 'plot' uses 'ordilabel' for text
+	labels.
+
 	* orditkplot: added option to copy the current graph to a TIFF
 	file. The capabilities("tiff") check was added in R-2.8.0, but the
 	test works in R < 2.8.0 as well.



More information about the Vegan-commits mailing list