[Vegan-commits] r940 - in branches/1.15: R inst man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Aug 23 07:56:20 CEST 2009


Author: jarioksa
Date: 2009-08-23 07:56:18 +0200 (Sun, 23 Aug 2009)
New Revision: 940

Modified:
   branches/1.15/R/panel.ordi.R
   branches/1.15/inst/ChangeLog
   branches/1.15/man/ordixyplot.Rd
Log:
merged panel.ordiarrows: r813, 814, 835, 879

Modified: branches/1.15/R/panel.ordi.R
===================================================================
--- branches/1.15/R/panel.ordi.R	2009-08-22 12:11:22 UTC (rev 939)
+++ branches/1.15/R/panel.ordi.R	2009-08-23 05:56:18 UTC (rev 940)
@@ -1,18 +1,37 @@
-`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*ps$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, code = 2,
+         ...)
+{
+    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: branches/1.15/inst/ChangeLog
===================================================================
--- branches/1.15/inst/ChangeLog	2009-08-22 12:11:22 UTC (rev 939)
+++ branches/1.15/inst/ChangeLog	2009-08-23 05:56:18 UTC (rev 940)
@@ -37,6 +37,8 @@
 	* merged r931: ordihull, ordiellipse gained arg 'label' and
 	invisibly return their result (summary() not yet merged).
 
+	* panel.ordi has now 'arrows': merged r813, 814, 835, 879.
+
 Version 1.15-3 (released June 17, 2009)
 
 	* merged revs 866 to 868: changed the way capscale displays

Modified: branches/1.15/man/ordixyplot.Rd
===================================================================
--- branches/1.15/man/ordixyplot.Rd	2009-08-22 12:11:22 UTC (rev 939)
+++ branches/1.15/man/ordixyplot.Rd	2009-08-23 05:56:18 UTC (rev 940)
@@ -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