[Vegan-commits] r1969 - in pkg/vegan: inst man tests/Examples

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Oct 30 19:42:19 CET 2011


Author: jarioksa
Date: 2011-10-30 19:42:19 +0100 (Sun, 30 Oct 2011)
New Revision: 1969

Modified:
   pkg/vegan/inst/ChangeLog
   pkg/vegan/man/ordiplot3d.Rd
   pkg/vegan/tests/Examples/vegan-Ex.Rout.save
Log:
tell how to use xyz.convert to add points to ordiplot3d graph

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2011-10-30 17:52:06 UTC (rev 1968)
+++ pkg/vegan/inst/ChangeLog	2011-10-30 18:42:19 UTC (rev 1969)
@@ -4,6 +4,10 @@
 
 Version 2.1-6 (opened October 30, 2011)
 
+	* ordiplot3d: expanded example to show how to use xyz.convert() to
+	add points as per
+	https://stat.ethz.ch/pipermail/r-help/2011-October/293955.html
+
 	* oecosimu: new proposition for implementing parallel processing.
 	The relevant arguments are now 'parallel = getOption("mc.cores",
 	1)' and 'cl'. The 'parallel' defaults to 1 (no parallel

Modified: pkg/vegan/man/ordiplot3d.Rd
===================================================================
--- pkg/vegan/man/ordiplot3d.Rd	2011-10-30 17:52:06 UTC (rev 1968)
+++ pkg/vegan/man/ordiplot3d.Rd	2011-10-30 18:42:19 UTC (rev 1969)
@@ -85,19 +85,21 @@
   functions. 
 
   Function \code{ordiplot3d} plots only points. However, it returns
-  invisibly an object inheriting from \code{\link{ordiplot}} so that you
-  can use \code{\link{identify.ordiplot}} to identify \code{"points"} or
-  \code{"arrows"}. The underlying
-  \code{\link[scatterplot3d]{scatterplot3d}} function accepts \code{type
-    = "n"} so that only the axes, biplot arrows and centroids of
-  environmental variables will be plotted, and the ordination scores can
-  be added with \code{\link{text.ordiplot}} or
-  \code{\link{points.ordiplot}}. Further, you can use any functions from
-  the \code{\link{ordihull}} family with the invisible result of
+  invisibly an object inheriting from \code{\link{ordiplot}} so that
+  you can use \code{\link{identify.ordiplot}} to identify
+  \code{"points"} or \code{"arrows"}. The underlying
+  \code{\link[scatterplot3d]{scatterplot3d}} function accepts
+  \code{type = "n"} so that only the axes, biplot arrows and centroids
+  of environmental variables will be plotted, and the ordination
+  scores can be added with \code{\link{text.ordiplot}} or
+  \code{\link{points.ordiplot}}. Further, you can use any functions
+  from the \code{\link{ordihull}} family with the invisible result of
   \code{\link{ordiplot3d}}, but you must remember to specify the
   \code{display} as \code{"points"} or \code{"arrows"}. To change the
-  viewing angle, orientation etc. you must see
-  \code{\link[scatterplot3d]{scatterplot3d}}.
+  viewing angle, orientation etc.{} you must see
+  \code{\link[scatterplot3d]{scatterplot3d}}. Only one kind of scores
+  will be plotted.  See Examples for plotting both species and
+  site scores.
 
   Function \code{ordigl} makes a dynamic three-dimensional graph that
   can be rotated with mouse, and zoomed into with mouse buttons or wheel
@@ -121,20 +123,25 @@
   \code{\link[rgl]{rgl.points}}, \code{\link[rgl]{rgl.texts}},
  \code{\link[rgl]{rgl.lines}} and many others can be used. 
 }
- \value{
+ 
+\value{
+
   Function \code{ordiplot3d} returns invisibly an object of class
-  \code{"ordiplot3d"} inheriting from \code{\link{ordiplot}}. The return
-  object will contain the coordinates projected onto two dimensions for
-  \code{"points"}, and possibly for the heads of \code{"arrows"} and
-  \code{"centroids"} of environmental variables. Functions like
-  \code{\link{identify.ordiplot}}, \code{\link{points.ordiplot}},
-  \code{\link{text.ordiplot}} can use this result, as well as
-  \code{\link{ordihull}} and other functions documented with the
-  latter. In addition, the result will contain the object returned by
-  \code{\link[scatterplot3d]{scatterplot3d}}, including function
-  \code{xyz.converter} which projects three-dimensional
-  coordinates onto the plane used in the current plot. 
+  \code{"ordiplot3d"} inheriting from \code{\link{ordiplot}}. The
+  return object will contain the coordinates projected onto two
+  dimensions for \code{"points"}, and possibly for the heads of
+  \code{"arrows"} and \code{"centroids"} of environmental
+  variables. Functions like \code{\link{identify.ordiplot}},
+  \code{\link{points.ordiplot}}, \code{\link{text.ordiplot}} can use
+  this result, as well as \code{\link{ordihull}} and other functions
+  documented with the latter. In addition, the result will contain the
+  object returned by \code{\link[scatterplot3d]{scatterplot3d}},
+  including function \code{xyz.convert} which projects
+  three-dimensional coordinates onto the plane used in the current
+  plot (see Examples).
+
   Function \code{ordirgl} returns nothing.
+
 }
 
 \author{Jari Oksanen }
@@ -167,21 +174,24 @@
 ## Examples are not run, because they need non-standard packages
 ## 'scatterplot3d' and 'rgl' (and the latter needs user interaction).
 #####
-#### Default 'ordiplot3d'
+### Default 'ordiplot3d'
 \dontrun{
 data(dune)
 data(dune.env)
 ord <- cca(dune ~ A1 + Moisture, dune.env)
 ordiplot3d(ord)
-#### A boxed 'pin' version
+### A boxed 'pin' version
 ordiplot3d(ord, type = "h")
-#### More user control
-pl <- ordiplot3d(ord, angle=15, type="n")
+### More user control
+pl <- ordiplot3d(ord, scaling = 3, angle=15, type="n")
 points(pl, "points", pch=16, col="red", cex = 0.7)
-#### identify(pl, "arrows", col="blue") would put labels in better positions
+### identify(pl, "arrows", col="blue") would put labels in better positions
 text(pl, "arrows", col="blue", pos=3)
-text(pl, "centroids", col="blue", pos=1, cex = 1.2)
-#### ordirgl
+text(pl, "centroids", col="blue", pos=1, cex = 1)
+### Add species using xyz.convert function returned by ordiplot3d
+sp <- scores(ord, choices=1:3, display="species", scaling=3)
+text(pl$xyz.convert(sp), rownames(sp), cex=0.7, xpd=TRUE)
+### ordirgl
 ordirgl(ord, size=2)
 ordirgl(ord, display = "species", type = "t")
 rgl.quit()

Modified: pkg/vegan/tests/Examples/vegan-Ex.Rout.save
===================================================================
--- pkg/vegan/tests/Examples/vegan-Ex.Rout.save	2011-10-30 17:52:06 UTC (rev 1968)
+++ pkg/vegan/tests/Examples/vegan-Ex.Rout.save	2011-10-30 18:42:19 UTC (rev 1969)
@@ -1,5 +1,5 @@
 
-R version 2.14.0 RC (2011-10-27 r57452)
+R version 2.14.0 RC (2011-10-29 r57474)
 Copyright (C) 2011 The R Foundation for Statistical Computing
 ISBN 3-900051-07-0
 Platform: x86_64-apple-darwin10.8.0/x86_64 (64-bit)
@@ -23,7 +23,7 @@
 > options(warn = 1)
 > library('vegan')
 Loading required package: permute
-This is vegan 2.1-5
+This is vegan 2.1-6
 > 
 > assign(".oldSearch", search(), pos = 'CheckExEnv')
 > cleanEx()
@@ -154,14 +154,14 @@
 > plot(ef)
 > ordisurf(mod ~ pH, varechem, knots = 1, add = TRUE)
 Loading required package: mgcv
-This is mgcv 1.7-6. For overview type 'help("mgcv-package")'.
+This is mgcv 1.7-9. For overview type 'help("mgcv-package")'.
 
 Family: gaussian 
 Link function: identity 
 
 Formula:
 y ~ poly(x1, 1) + poly(x2, 1)
-<environment: 0x101fadcd0>
+<environment: 0x101faf2d8>
 Total model degrees of freedom 3 
 
 GCV score: 0.0427924
@@ -4332,21 +4332,24 @@
 > ## Examples are not run, because they need non-standard packages
 > ## 'scatterplot3d' and 'rgl' (and the latter needs user interaction).
 > #####
-> #### Default 'ordiplot3d'
+> ### Default 'ordiplot3d'
 > ## Not run: 
 > ##D data(dune)
 > ##D data(dune.env)
 > ##D ord <- cca(dune ~ A1 + Moisture, dune.env)
 > ##D ordiplot3d(ord)
-> ##D #### A boxed 'pin' version
+> ##D ### A boxed 'pin' version
 > ##D ordiplot3d(ord, type = "h")
-> ##D #### More user control
-> ##D pl <- ordiplot3d(ord, angle=15, type="n")
+> ##D ### More user control
+> ##D pl <- ordiplot3d(ord, scaling = 3, angle=15, type="n")
 > ##D points(pl, "points", pch=16, col="red", cex = 0.7)
-> ##D #### identify(pl, "arrows", col="blue") would put labels in better positions
+> ##D ### identify(pl, "arrows", col="blue") would put labels in better positions
 > ##D text(pl, "arrows", col="blue", pos=3)
-> ##D text(pl, "centroids", col="blue", pos=1, cex = 1.2)
-> ##D #### ordirgl
+> ##D text(pl, "centroids", col="blue", pos=1, cex = 1)
+> ##D ### Add species using xyz.convert function returned by ordiplot3d
+> ##D sp <- scores(ord, choices=1:3, display="species", scaling=3)
+> ##D text(pl$xyz.convert(sp), rownames(sp), cex=0.7, xpd=TRUE)
+> ##D ### ordirgl
 > ##D ordirgl(ord, size=2)
 > ##D ordirgl(ord, display = "species", type = "t")
 > ##D rgl.quit()
@@ -4685,14 +4688,14 @@
 > vare.mds <- monoMDS(vare.dist)
 > with(varechem, ordisurf(vare.mds, Baresoil, bubble = 5))
 Loading required package: mgcv
-This is mgcv 1.7-6. For overview type 'help("mgcv-package")'.
+This is mgcv 1.7-9. For overview type 'help("mgcv-package")'.
 
 Family: gaussian 
 Link function: identity 
 
 Formula:
 y ~ s(x1, x2, k = knots)
-<environment: 0x109cec958>
+<environment: 0x10a0c9000>
 
 Estimated degrees of freedom:
 6.4351  total = 7.435071 
@@ -4708,7 +4711,7 @@
 
 Formula:
 y ~ s(x1, x2, k = knots)
-<environment: 0x1098eef40>
+<environment: 0x109adf6d0>
 
 Estimated degrees of freedom:
 6.1039  total = 7.103853 
@@ -4857,14 +4860,14 @@
 > ## Map of PCNMs in the sample plot
 > ordisurf(mite.xy, scores(pcnm1, choi=1), bubble = 4, main = "PCNM 1")
 Loading required package: mgcv
-This is mgcv 1.7-6. For overview type 'help("mgcv-package")'.
+This is mgcv 1.7-9. For overview type 'help("mgcv-package")'.
 
 Family: gaussian 
 Link function: identity 
 
 Formula:
 y ~ s(x1, x2, k = knots)
-<environment: 0x108f78578>
+<environment: 0x10692bee0>
 
 Estimated degrees of freedom:
 8.9275  total = 9.927492 
@@ -4877,7 +4880,7 @@
 
 Formula:
 y ~ s(x1, x2, k = knots)
-<environment: 0x107654278>
+<environment: 0x1096e8098>
 
 Estimated degrees of freedom:
 7.7529  total = 8.75294 
@@ -4890,7 +4893,7 @@
 
 Formula:
 y ~ s(x1, x2, k = knots)
-<environment: 0x109e1a758>
+<environment: 0x10a7e9830>
 
 Estimated degrees of freedom:
 8.8962  total = 9.89616 
@@ -7152,14 +7155,14 @@
 > ## add fitted surface of diversity to the model
 > ordisurf(mod, diversity(dune), add = TRUE)
 Loading required package: mgcv
-This is mgcv 1.7-6. For overview type 'help("mgcv-package")'.
+This is mgcv 1.7-9. For overview type 'help("mgcv-package")'.
 
 Family: gaussian 
 Link function: identity 
 
 Formula:
 y ~ s(x1, x2, k = knots)
-<environment: 0x10a9c72a8>
+<environment: 0x10952b190>
 
 Estimated degrees of freedom:
 2  total = 3 
@@ -7635,7 +7638,7 @@
 > ### * <FOOTER>
 > ###
 > cat("Time elapsed: ", proc.time() - get("ptime", pos = 'CheckExEnv'),"\n")
-Time elapsed:  90.316 1.908 92.398 0 0 
+Time elapsed:  81.081 1.732 83.592 0 0 
 > grDevices::dev.off()
 null device 
           1 



More information about the Vegan-commits mailing list