[Vegan-commits] r2162 - in pkg/vegan: R inst
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu May 10 17:47:26 CEST 2012
Author: jarioksa
Date: 2012-05-10 17:47:26 +0200 (Thu, 10 May 2012)
New Revision: 2162
Modified:
pkg/vegan/R/ordiplot3d.R
pkg/vegan/inst/ChangeLog
Log:
try to get equal aspect ratio to ordiplot3d
Modified: pkg/vegan/R/ordiplot3d.R
===================================================================
--- pkg/vegan/R/ordiplot3d.R 2012-05-10 08:26:06 UTC (rev 2161)
+++ pkg/vegan/R/ordiplot3d.R 2012-05-10 15:47:26 UTC (rev 2162)
@@ -7,8 +7,17 @@
if (missing(xlab)) xlab <- colnames(x)[1]
if (missing(ylab)) ylab <- colnames(x)[2]
if (missing(zlab)) zlab <- colnames(x)[3]
+ ### scatterplot3d does not allow setting equal aspect ratio. We
+ ### try to compensate this by setting equal limits for all axes
+ ### and hoping the graph is more or less square so that the lines
+ ### come correctly out.
+ rnge <- apply(x, 2, range)
+ scl <- c(-0.5, 0.5) * max(apply(rnge, 2, diff))
pl <- ordiArgAbsorber(x[, 1], x[, 2], x[, 3],
- xlab = xlab, ylab = ylab, zlab = zlab,
+ xlab = xlab, ylab = ylab, zlab = zlab,
+ xlim = mean(rnge[,1]) + scl,
+ ylim = mean(rnge[,2]) + scl,
+ zlim = mean(rnge[,3]) + scl,
FUN = "scatterplot3d", ...)
pl$points3d(range(x[, 1]), c(0, 0), c(0, 0), type = "l",
col = ax.col)
Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog 2012-05-10 08:26:06 UTC (rev 2161)
+++ pkg/vegan/inst/ChangeLog 2012-05-10 15:47:26 UTC (rev 2162)
@@ -18,7 +18,10 @@
* ordiplot3d: function returns the projected coordinates of the
origin, and function envfit.convert() that can project a
- three-dimensional envfit() result to the current plot.
+ three-dimensional envfit() result to the current plot. Unlike
+ originally assumed, the function will not set equal aspect ratio
+ for all axes. We try to compensate this by setting equal scaling
+ to all axes.
Version 2.1-14 (opened March 9, 2012)
More information about the Vegan-commits
mailing list