[Vegan-commits] r278 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Mar 24 07:01:20 CET 2008


Author: jarioksa
Date: 2008-03-24 07:01:19 +0100 (Mon, 24 Mar 2008)
New Revision: 278

Modified:
   pkg/R/plot.procrustes.R
Log:
plot.procrustes sometimes failed when two configurations are identical

Modified: pkg/R/plot.procrustes.R
===================================================================
--- pkg/R/plot.procrustes.R	2008-03-21 14:38:20 UTC (rev 277)
+++ pkg/R/plot.procrustes.R	2008-03-24 06:01:19 UTC (rev 278)
@@ -1,5 +1,5 @@
 "plot.procrustes" <-
-function (x, kind = 1, choices = c(1,2), xlab, ylab, main, ar.col = "blue", 
+    function (x, kind = 1, choices = c(1,2), xlab, ylab, main, ar.col = "blue", 
           len = 0.05,  ...) 
 {
     Yrot <- x$Yrot[, choices]
@@ -20,6 +20,8 @@
 	        abline(v = 0, lty = 2)
             abline(h = 0, lty = 2)
             if (ncol(x$rotation) == 2) {
+                ## Sometimes rotation[1,1] is 2.2e-16 above one
+                x$rotation[1,1] <- min(x$rotation[1,1], 1)
                 abline(0, tan(acos(x$rotation[1, 1])), lty = 1)
                 abline(0, 1/tan(acos(-x$rotation[1, 1])), lty = 1)
             }



More information about the Vegan-commits mailing list