Learn R Programming

berryFunctions (version 1.22.5)

spiralDateAnim: Animated spiral graph

Description

Animation of (daily) time series along spiral

Usage

spiralDateAnim(
  dates,
  values,
  data,
  steps = 100,
  sleep = 0,
  progbar = TRUE,
  ...
)

Arguments

dates, values, data

Input as in spiralDate

steps

Number of steps (images) in animation. DEFAULT: 100

sleep

Pause time between frames, in seconds, passed to Sys.sleep. DEFAULT: 0

progbar

Should a progress bar be drawn? Useful if you have a large dataset or many steps. DEFAULT: TRUE

...

Further arguments passed to spiralDate

Author

Berry Boessenkool, berry-b@gmx.de, May 2016

See Also

spiralDate, linLogHist

Examples

Run this code

set.seed(42)
x <- as.Date("1985-01-01")+0:5000
y <- cumsum(rnorm(5001))+50
y <- y + sin(0:5000/366*2*pi)*max(abs(y))/2
plot(x,y)

spiralDateAnim(x,y, steps=10, sleep=0.01) # 0.05 might be smoother...

if (FALSE) {
## Rcmd check --as-cran doesn't like to open external devices such as pdf,
## so this example is excluded from running in the checks.
pdf("spiralDateAnimation.pdf")
spiralDateAnim(x,y, main="Example Transition", col=divPal(100), format=" ")
dev.off()

# if you have FFmpeg installed, you can use the animation package like this:
library2(animation)
saveVideo(spiralDateAnim(x,y, steps=300), video.name="spiral_anim.mp4", interval=0.1,
    ffmpeg="C:/Program Files/R/ffmpeg/bin/ffmpeg.exe")

}

Run the code above in your browser using DataLab