[Dplr-commits] r1095 - in pkg/dplR: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun May 6 19:51:35 CEST 2018


Author: darwinalexander
Date: 2018-05-06 19:51:35 +0200 (Sun, 06 May 2018)
New Revision: 1095

Modified:
   pkg/dplR/R/plotRings.R
   pkg/dplR/man/plotRings.Rd
Log:
Added the new argument "xy.lim" into plotRings function to set manually the values for the xy axes.

Modified: pkg/dplR/R/plotRings.R
===================================================================
--- pkg/dplR/R/plotRings.R	2018-05-06 17:15:04 UTC (rev 1094)
+++ pkg/dplR/R/plotRings.R	2018-05-06 17:51:35 UTC (rev 1095)
@@ -7,6 +7,7 @@
                       d2pith = NA,
                       col.inrings = "grey", col.outring = "black", 
                       x.rings = "none", col.x.rings = "red",
+                      xy.lim = auto.lim,
                       species.name = NA,
                       saveGIF=FALSE, fname="GIF_plotRings.gif") {
   
@@ -97,10 +98,10 @@
       cols <-  c(rep(col.inrings, i-1), col.outring) 
       narrow.cols <- c(col.narrow.rings[1:i-1], col.outring) # colors when is selected "narrow.rings"
       wider.cols <- c(col.wider.rings[1:i-1], col.outring) # colors when is selected "wider.rings"
+      auto.lim <- max(z, na.rm = TRUE) * 2.0
       
-      max.acc <- max(z, na.rm = TRUE) * 2.0
       symbols(y = y[1:i], x = if(length(x) > 0) y[1:i] else x[1:i],
-              circles=z[1:i], inches=FALSE, xlim = c(-max.acc, max.acc), ylim = c(-max.acc, max.acc), 
+              circles=z[1:i], inches=FALSE, xlim = c(-xy.lim, xy.lim), ylim = c(-xy.lim, xy.lim), 
               xlab='Width [mm]', ylab='Width [mm]', main=mtext(bquote(~bold(.("Annual tree growth"))),
                                                      line=1.5,adj=0.5, side=3, cex=1.5), 
               sub=if(!is.na(species.name)) mtext(bquote(~plain(.("(")) ~italic(.(species.name)) ~plain(.(")"))),
@@ -123,10 +124,10 @@
     narrow.cols <- c(col.narrow.rings[1:length(x)-1], col.outring) # colors when is selected "narrow.rings"
     wider.cols <- c(col.wider.rings[1:length(x)-1], col.outring) # colors when is selected "wider.rings"
     rings.lwd <- c(rep(1, length(x)), 3)
+    auto.lim <- max(z, na.rm = TRUE) * 2.0
     
-    max.acc <- max(z, na.rm = TRUE) * 2.0
     symbols( y = y, x = if(length(x) > 0) y else x,
-             circles=z, inches=FALSE, xlim = c(-max.acc, max.acc), ylim = c(-max.acc, max.acc), 
+             circles=z, inches=FALSE, xlim = c(-xy.lim, xy.lim), ylim = c(-xy.lim, xy.lim), 
              xlab='Width [mm]', ylab='Width [mm]', main=mtext(bquote(~bold(.("Annual tree growth"))), line=1.5,adj=0.5, 
                                                     side=3, cex=1.5), sub= if(!is.na(species.name)) mtext(bquote(~plain(.("(")) ~italic(.(species.name)) ~plain(.(")"))),
                                                                                                           line=0.5,adj=0.5, side=3, cex=1), 
@@ -152,10 +153,10 @@
         cols <-  c(rep(col.inrings, i-1), col.outring) 
         narrow.cols <- c(col.narrow.rings[1:i-1], col.outring) # colors when is selected "narrow.rings"
         wider.cols <- c(col.wider.rings[1:i-1], col.outring) # colors when is selected "wider.rings"
+        auto.lim <- max(z, na.rm = TRUE) * 2.0
         
-        max.acc <- max(z, na.rm = TRUE) * 2.0
         symbols(y = y[1:i], x = if(length(x) > 0) y[1:i] else x[1:i],
-                circles=z[1:i], inches=FALSE, xlim = c(-max.acc, max.acc), ylim = c(-max.acc, max.acc), 
+                circles=z[1:i], inches=FALSE, xlim = c(-xy.lim, xy.lim), ylim = c(-xy.lim, xy.lim), 
                 xlab='Width [mm]', ylab='Width [mm]', main=mtext(bquote(~bold(.("Annual tree growth"))),
                                                        line=1.5,adj=0.5, side=3, cex=1.5), 
                 sub=if(!is.na(species.name)) mtext(bquote(~plain(.("(")) ~italic(.(species.name)) ~plain(.(")"))),
@@ -178,10 +179,10 @@
     narrow.cols <- c(col.narrow.rings[1:length(x)-1], col.outring) # colors when is selected "narrow.rings"
     wider.cols <- c(col.wider.rings[1:length(x)-1], col.outring) # colors when is selected "wider.rings"
     rings.lwd <- c(rep(1, length(x)), 3)
+    auto.lim <- max(z, na.rm = TRUE) * 2.0
     
-    max.acc <- max(z, na.rm = TRUE) * 2.0
     symbols( y = y, x = if(length(x) > 0) y else x,
-             circles=z, inches=FALSE, xlim = c(-max.acc, max.acc), ylim = c(-max.acc, max.acc), 
+             circles=z, inches=FALSE, xlim = c(-xy.lim, xy.lim), ylim = c(-xy.lim, xy.lim), 
              xlab='Width [mm]', ylab='Width [mm]', main=mtext(bquote(~bold(.("Annual tree growth"))), line=1.5,adj=0.5, 
                                                     side=3, cex=1.5), sub= if(!is.na(species.name)) mtext(bquote(~plain(.("(")) ~italic(.(species.name)) ~plain(.(")"))),
                                                                                                           line=0.5,adj=0.5, side=3, cex=1), 

Modified: pkg/dplR/man/plotRings.Rd
===================================================================
--- pkg/dplR/man/plotRings.Rd	2018-05-06 17:15:04 UTC (rev 1094)
+++ pkg/dplR/man/plotRings.Rd	2018-05-06 17:51:35 UTC (rev 1095)
@@ -67,6 +67,9 @@
   \item{col.x.rings}{ The color to be used for the \code{\var{x.rings}}.
   See section \sQuote{Color Specification} for suitable values.  }
   
+  \item{xy.lim}{a \code{numeric} vector giving the limit to xy coordinates ranges. 
+  Default is \code{\var{auto.lim}} which calculate automatically the xy axes limits.}
+  
   \item{species.name}{ an optional \code{character} string that 
   defines the species name in the plot.  }
 



More information about the Dplr-commits mailing list