if (FALSE) {
## Create static and animated lines
# Create new viewer
svg.new(file='svgviewr.html', animate.duration=1)
# Plot 3 connected lines with 3 different colors
svg.lines(x=rbind(c(30,-20,0), c(30,-30,0), c(40,-30,0), c(40,-35,0)),
col=c("red", "green", "blue"), lwd=5, opacity=0.7)
# Plot single line that switches among 3 colors
svg.lines(x=rbind(c(15,0,0), c(15,-20,0)), col=c("red", "green", "blue"), lwd=3, opacity=0.7)
# Create a line in two animation states
arr <- array(c(rbind(c(15,-30,0), c(15,-50,0)), rbind(c(10,-30,0), c(10,-50,0))), dim=c(2,3,2))
# Plot
svg.lines(x=arr, col=c("red", "green"), lwd=3, opacity=0.7)
# Create two connected lines in 3 animation states
arr <- array(c(30,30,40, -40,-50,-50, 0,0,0, 40,40,50, -40,-50,-50,
0,0,0, 50,50,60, -40,-50,-50, 0,0,0), dim=c(3,3,3))
# Plot
svg.lines(x=arr, col=c("red", "green"), lwd=5, opacity=0.7)
# Close connection
svg.close()
# Open svgviewr.html to visualize
}
Run the code above in your browser using DataLab