Description Usage Arguments Details Examples
Draw an animation of line segments or arrows.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
x0, y0, x1, y1, col, lty, lwd, length, angle, code, ... |
arguments passed to |
times, speed, show, use.times, window, window.process |
see |
fn |
underlying function to use |
anim.segments and anim.arrows draw lines on to an existing plot.
If you want to redraw the plot between each frame, use anim.arrowplot
or anim.segmentplot.
If both x1 and y1 are missing, then segments are plotted
from the current time to the following time in each frame. If only x1
is missing it is set equal to x0, similarly if only y1 is
missing.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | anim.segments(x0=rep(1:5, 5), y0=rep(1:5, each=5), y1=rep(2:6, each=5),
times=rep(1:5, each=5) )
## Short version
anim.arrowplot(rep(1:5, 5), rep(1:5, each=5), times=5)
if (require('maps')) {
hr <- subset(hurricanes, lat > 0 & lat < 50 & lon > -95 & lon < -20 &
Shour %% 6 == 0)
hr$dlat <- cos(hr$diruv/360*2*pi) * hr$maguv / 8
hr$dlon <- sin(hr$diruv/360*2*pi) * hr$maguv / 8
hr$name <- sub("\\s+$", "", hr$name)
map('world', xlim=c(-95,-20), ylim=c(0,50))
title("Hurricanes, 2009")
with(hr[!duplicated(hr$name),], text(lon, lat,
labels=paste0(name, "\n", Yr), cex=0.8))
with(hr, anim.arrows(x0=lon, y0=lat, y1=lat+dlat, x1=lon+dlon,
times=Shour, speed=12, col=rgb(0,0,1,0.8), length=.1, lwd=2))
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.