[Vegan-commits] r813 - in pkg/vegan: R inst man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Apr 23 15:31:17 CEST 2009


Author: jarioksa
Date: 2009-04-23 15:31:16 +0200 (Thu, 23 Apr 2009)
New Revision: 813

Modified:
   pkg/vegan/R/panel.ordi.R
   pkg/vegan/inst/ChangeLog
   pkg/vegan/man/ordixyplot.Rd
Log:
added a Lattice variant of ordiarrows for ordixyplot

Modified: pkg/vegan/R/panel.ordi.R
===================================================================
--- pkg/vegan/R/panel.ordi.R	2009-04-23 12:05:00 UTC (rev 812)
+++ pkg/vegan/R/panel.ordi.R	2009-04-23 13:31:16 UTC (rev 813)
@@ -1,18 +1,36 @@
-`panel.ordi` <-
-    function(x, y, biplot, type = type,  ...)
+panel.ordi <-
+function(x, y, biplot, type = type,  ...)
 {
     panel.xyplot(x, y, type = type,  ...)
     tp <- trellis.par.get()
+    sp <- tp$superpose.symbol
+    ps <- tp$plot.symbol
     if ("biplot" %in% type && !is.null(biplot$arrows)) {
         panel.arrows(0, 0, biplot$arrows[,2], biplot$arrows[,1],
-                     col=tp$superpose.symbol$col, ...)
+                     col=sp$col, ...)
     }
     if ("biplot" %in% type && !is.null(biplot$centres)) {
         panel.xyplot(biplot$centres[,2], biplot$centres[,1],
-                     col = tp$plot.symbol$col, 
-                     pch = "+", cex = 3*tp$plot.symbol$cex, lwd=2,
+                     col = ps$col, 
+                     pch = "+", cex = 3*tps$cex, lwd=2,
                      ...)
     }
+    if ("arrows" %in% type) {
+        panel.superpose(x, y, panel.groups= "panel.ordiarrows",  ...)
+    }
     panel.abline(h=0, lty = 3)
     panel.abline(v=0, lty = 3)
 }
+
+## needed for "arrows" %in% type
+panel.ordiarrows <-
+function(x, y, subscripts, 
+         ends = "last", type = "open", length = 0.25, angle = 30, ...) 
+{
+    n <- length(x)
+    panel.arrows(x[-n], y[-n], x[-1], y[-1], ends = ends, type = "open",
+                 length = length, angle = angle, code = code, 
+                 col = trellis.par.get("superpose.line")$col,
+                 lwd = trellis.par.get("superpose.line")$lwd, 
+                 ) 
+}

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2009-04-23 12:05:00 UTC (rev 812)
+++ pkg/vegan/inst/ChangeLog	2009-04-23 13:31:16 UTC (rev 813)
@@ -8,8 +8,11 @@
 
 	* ordixyplot: failed in constrained ordination (cca, rda,
 	capscale). Was broken in rev108 on Nov 7, 2007(!). The biplot was
-	rotated 90 degrees: it seems that lattice calls x y and y x...
+	rotated 90 degrees: it seems that lattice calls x y and y x. 
 
+	* ordixyplot & ordisplom: Gained a new type = "arrows" that is a
+	Lattice version of ordiarrows.
+
 	* RsquareAdj: defined as generic function. The old RsquareAdj is
 	now the "default" method, and there are specific methods for
 	"rda", "cca" (= NA), "lm" and "glm" objects. Not yet documented,

Modified: pkg/vegan/man/ordixyplot.Rd
===================================================================
--- pkg/vegan/man/ordixyplot.Rd	2009-04-23 12:05:00 UTC (rev 812)
+++ pkg/vegan/man/ordixyplot.Rd	2009-04-23 13:31:16 UTC (rev 813)
@@ -3,6 +3,7 @@
 \alias{ordisplom}
 \alias{ordicloud}
 \alias{panel.ordi}
+\alias{panel.ordiarrows}
 \alias{panel.ordi3d}
 \alias{prepanel.ordi3d}
 \alias{ordilattice.getEnvfit}
@@ -48,9 +49,16 @@
     as \code{ordixyplot}.}
   \item{type}{The type of plot. This knows the same alternatives as
     \code{\link[lattice]{panel.xyplot}}. In addition \code{ordixyplot}
-    has alternative \code{"biplot"} which displays fitted vectors and
+    has alternatives \code{"biplot"} and \code{"arrows"}. The first
+    displays fitted vectors and 
     factor centroids of \code{envfit}, or in constrained ordination, the
-    biplot arrows and factor centroids if \code{envfit} is not given.}
+    biplot arrows and factor centroids if \code{envfit} is not
+    given. The second (\code{type = "arrows"} is a trellis variant of
+    \code{\link{ordiarrows}} and draws arrows by \code{groups}. The
+    line parameters are controlled by
+    \code{\link[lattice]{trellis.par.set}} for \code{superpose.line}},
+    and the user can set \code{length}, \code{angle} and \code{ends}
+    parameters of \code{\link[trellis]{panel.arrows}}.}
   \item{\dots}{ Arguments passed to \code{\link{scores}} methods or
     \pkg{lattice} functions.}
 }



More information about the Vegan-commits mailing list