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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed May 23 08:54:38 CEST 2018


Author: andybunn
Date: 2018-05-23 08:54:38 +0200 (Wed, 23 May 2018)
New Revision: 1101

Modified:
   pkg/dplR/R/plotRings.R
   pkg/dplR/man/plotRings.Rd
Log:
Fixed animation bug in plotRings by moving the ani.options inside the expression for saveGIF.

Modified: pkg/dplR/R/plotRings.R
===================================================================
--- pkg/dplR/R/plotRings.R	2018-05-23 06:25:05 UTC (rev 1100)
+++ pkg/dplR/R/plotRings.R	2018-05-23 06:54:38 UTC (rev 1101)
@@ -102,7 +102,7 @@
       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
-      if(is.null(xy.lim)) xy.lim <- max(z, na.rm = TRUE) * 1.1
+      if(is.null(xy.lim)) xy.lim <- max(z, na.rm = TRUE) * 1.05
       
       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(-xy.lim, xy.lim), ylim = c(-xy.lim, xy.lim), 
@@ -129,7 +129,7 @@
     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
-    if(is.null(xy.lim)) xy.lim <- max(z, na.rm = TRUE) * 1.1
+    if(is.null(xy.lim)) xy.lim <- max(z, na.rm = TRUE) * 1.05
     
     symbols( y = y, x = if(length(x) > 0) y else x,
              circles=z, inches=FALSE, xlim = c(-xy.lim, xy.lim), ylim = c(-xy.lim, xy.lim), 
@@ -151,6 +151,9 @@
   if (saveGIF == TRUE) {
     
     saveGIF({
+      ani.options(interval = sys.sleep, nmax = 50, 
+      ani.width = 1000, ani.height = 1000)
+      
       par(bg="white")
       
       # With animation
@@ -160,7 +163,7 @@
         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
-        if(is.null(xy.lim)) xy.lim <- max(z, na.rm = TRUE) * 1.1
+        if(is.null(xy.lim)) xy.lim <- max(z, na.rm = TRUE) * 1.05
         
         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(-xy.lim, xy.lim), ylim = c(-xy.lim, xy.lim), 
@@ -177,8 +180,7 @@
         if(year.labels == TRUE) title(sub=year[i])
       }
       # AGB changed interval to delay which works under mac. Not sure about windows.
-    }, movie.name = fname, delay = sys.sleep, nmax = 10, 
-    ani.width = 1000, ani.height = 1000)
+    }, movie.name = fname)
   }
   
   # Without saving the GIF
@@ -188,7 +190,7 @@
     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
-    if(is.null(xy.lim)) xy.lim <- max(z, na.rm = TRUE) * 1.1
+    if(is.null(xy.lim)) xy.lim <- max(z, na.rm = TRUE) * 1.05
     
     symbols( y = y, x = if(length(x) > 0) y else x,
              circles=z, inches=FALSE, xlim = c(-xy.lim, xy.lim), ylim = c(-xy.lim, xy.lim), 

Modified: pkg/dplR/man/plotRings.Rd
===================================================================
--- pkg/dplR/man/plotRings.Rd	2018-05-23 06:25:05 UTC (rev 1100)
+++ pkg/dplR/man/plotRings.Rd	2018-05-23 06:54:38 UTC (rev 1101)
@@ -141,14 +141,14 @@
                  x.rings = "wider.rings", col.x.rings = "green") 
 
 \dontrun{
-# Plot Rings and animate (requires ImageMagick)
+# Plot Rings and animate (requires ImageMagick to be installed in the PATH)
 res <- plotRings(yrs, anos1[,4], trwW = anos1[,5],year.labels = TRUE, 
                  animation = TRUE, sys.sleep = 0.1)
                  
-# Plot Rings and save as GIF (requires ImageMagick to be installed in PATH)
+# Plot Rings and save as GIF (requires ImageMagick to be installed in the PATH)
 library(animation)
 res <- plotRings(yrs, anos1[,4], trwW = anos1[,5],
-                 saveGIF = TRUE, fname="GIF_plotRings.gif")
+                 saveGIF = TRUE, fname="GIF_plotRings.gif",sys.sleep = 0.1)
 }
 
 # with four fake tree-ring series 



More information about the Dplr-commits mailing list