[Analogue-commits] r270 - in pkg: . R inst man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jul 24 22:04:43 CEST 2012


Author: gsimpson
Date: 2012-07-24 22:04:43 +0200 (Tue, 24 Jul 2012)
New Revision: 270

Modified:
   pkg/DESCRIPTION
   pkg/R/caterpillarPlot.R
   pkg/inst/ChangeLog
   pkg/man/caterpillarPlot.Rd
Log:
updates to caterpillarPlot

Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION	2012-05-16 12:14:17 UTC (rev 269)
+++ pkg/DESCRIPTION	2012-07-24 20:04:43 UTC (rev 270)
@@ -1,7 +1,7 @@
 Package: analogue
 Type: Package
 Title: Analogue and weighted averaging methods for palaeoecology
-Version: 0.9-5
+Version: 0.9-6
 Date: $Date$
 Depends: R (>= 2.15.0), stats, graphics, vegan (>= 1.17-12), lattice, grid, 
          MASS, princurve, mgcv

Modified: pkg/R/caterpillarPlot.R
===================================================================
--- pkg/R/caterpillarPlot.R	2012-05-16 12:14:17 UTC (rev 269)
+++ pkg/R/caterpillarPlot.R	2012-07-24 20:04:43 UTC (rev 270)
@@ -2,19 +2,26 @@
     UseMethod("caterpillarPlot")
 }
 
-`caterpillarPlot.data.frame` <- function(x, env, useN2 = TRUE, ...) {
+`caterpillarPlot.data.frame` <- function(x, env, useN2 = TRUE, xlab,
+                                         ...) {
     ## compute the optima
     opt <- optima(x = x, env = env)
     ## and tolerances
     tol <- tolerance(x = x, env = env, useN2 = useN2)
 
+    if(missing(xlab)) {
+        ## grab xlab from env
+        xlab <- deparse(substitute(env))
+    }
+
     ## do the plot
-    caterpillarPlot.default(x = opt, tol = tol, ...)
+    caterpillarPlot.default(x = opt, tol = tol, xlab = xlab, ...)
 }
 
 `caterpillarPlot.default` <- function(x, tol, mult = 1, decreasing = TRUE,
                                       labels, xlab = NULL, pch = 21, bg = "white",
-                                      col = "black", lcol = col, ...) {
+                                      col = "black", lcol = col,
+                                      frame.plot = FALSE, ...) {
     ## reorder
     opt <- x
     ord <- order(opt, decreasing = decreasing)
@@ -41,7 +48,7 @@
     nmai[2L] <- nmai[4L] + linch + 0.1
     par(mai = nmai)
 
-    ## ylab
+    ## xlab
     if(is.null(xlab))
         xlab <- deparse(substitute(env))
 
@@ -51,13 +58,13 @@
 
     ## do the plot
     plot(c(lwr, upr), rep.int(yvals, 2), type = "n", axes = FALSE,
-         ylab = "", xlab = xlab, ylim = range(0, yvals + 1), ...)
+         ylab = "", xlab = xlab, ylim = range(0, yvals + 1),
+         frame.plot = frame.plot, ...)
     abline(h = yvals, lty = 1, lwd = 0.5, col = "lightgray")
     segments(lwr, yvals, upr, yvals, col = lcol, ...)
     points(opt, yvals, pch = pch, bg = bg, col = col, ...)
     axis(side = 1, ...)
     axis(side = 2, labels = labels, at = yvals, las = 1, ...)
-    box()
 
     ## return object
     out <- data.frame(Optima = opt, Tolerance = tol)

Modified: pkg/inst/ChangeLog
===================================================================
--- pkg/inst/ChangeLog	2012-05-16 12:14:17 UTC (rev 269)
+++ pkg/inst/ChangeLog	2012-07-24 20:04:43 UTC (rev 270)
@@ -1,5 +1,14 @@
 analogue Change Log
 
+Version 0.9-6
+
+	* caterpillarPlot: now no longer draws a box round the plot.
+
+	Bug fixed so that the data.frame method correctly identies the
+	`env` argument to label the plot with.
+
+	Updated help file.
+
 Version 0.9-5
 
 	* Stratiplot: the formula interface was stripping rows with NAs.

Modified: pkg/man/caterpillarPlot.Rd
===================================================================
--- pkg/man/caterpillarPlot.Rd	2012-05-16 12:14:17 UTC (rev 269)
+++ pkg/man/caterpillarPlot.Rd	2012-07-24 20:04:43 UTC (rev 270)
@@ -17,9 +17,9 @@
 
 \method{caterpillarPlot}{default}(x, tol, mult = 1, decreasing = TRUE,
                 labels, xlab = NULL, pch = 21, bg = "white",
-                col = "black", lcol = col, ...)
+                col = "black", lcol = col, frame.plot = FALSE, ...)
 
-\method{caterpillarPlot}{data.frame}(x, env, useN2 = TRUE, ...)
+\method{caterpillarPlot}{data.frame}(x, env, useN2 = TRUE, xlab, ...)
 
 \method{caterpillarPlot}{wa}(x, type = c("observed","model"), ...)
 }
@@ -48,6 +48,7 @@
     observed from the data. \code{"model"} uses the tolerances used in
     the WA model where very small tolerances have been reset for some
     definition of small.}
+  \item{frame.plot}{logical; should a box be drawn round the plot?}
   \item{\dots}{Additional graphical arguments to be passed on to
     plotting functions.}
 }
@@ -85,6 +86,7 @@
 ## customisation
 opttol <-
     caterpillarPlot(ImbrieKipp, SumSST, col = "red2", bg = "yellow",
+                    lcol = "blue",
                     xlab = expression(Summer~Sea~Surface~Temperature~(degree*C)))
 
 ## invisibly returns the optima and tolerances



More information about the Analogue-commits mailing list