[Vegan-commits] r472 - pkg/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Aug 13 08:06:03 CEST 2008
Author: jarioksa
Date: 2008-08-13 08:06:03 +0200 (Wed, 13 Aug 2008)
New Revision: 472
Modified:
pkg/R/plot.procrustes.R
Log:
plot.procrustes: a more certain fix to failure in plotting identical configurations
Modified: pkg/R/plot.procrustes.R
===================================================================
--- pkg/R/plot.procrustes.R 2008-08-12 08:49:10 UTC (rev 471)
+++ pkg/R/plot.procrustes.R 2008-08-13 06:06:03 UTC (rev 472)
@@ -20,10 +20,16 @@
abline(v = 0, lty = 2)
abline(h = 0, lty = 2)
if (ncol(x$rotation) == 2) {
- ## Sometimes rotation[1,1] is exactly 1 or 1+2.2e-16
- x$rotation[1,1] <- min(x$rotation[1,1], 1 - .Machine$double.eps)
- abline(0, tan(acos(x$rotation[1, 1])), lty = 1)
- abline(0, 1/tan(acos(-x$rotation[1, 1])), lty = 1)
+ ## Draw rotated axes only if they visibly differ from
+ ## unrotated axes
+ b <- abs(x$rotation[1,1])
+ EPS <- 1e-8
+ if (1 - b > EPS && b > EPS) {
+ abline(0, tan(acos(x$rotation[1, 1])), lty = 1)
+ abline(0, 1/tan(acos(-x$rotation[1, 1])), lty = 1)
+ } else {
+ abline(v = 0, h = 0)
+ }
}
else {
Y <- x$Yrot %*% t(x$rotation)
More information about the Vegan-commits
mailing list