if (FALSE) {
## Create animated sinusoid
# Create new viewer
svg.new(file='svgviewr.html', animate.duration=1)
# Create points with varying sin phase
n <- 100
x <- array(NA, dim=c(40, 2, n))
x_seq <- seq(-pi, pi, length=dim(x)[1])
n_seq <- seq(0, 2*pi, length=n)
for(i in 1:dim(x)[3]) x[, , i] <- cbind(x_seq, sin(x_seq + n_seq[i]))
# Draw points
svg.points(x, cex=2, lwd=1, col="blue")
# Close viewer connection
svg.close()
# Open svgviewr.html to visualize
}
Run the code above in your browser using DataLab