Description Usage Arguments Author(s) See Also Examples
Function for the animation of continuous-time continuous-space
epidemic data, i.e. objects inheriting from class "epidataCS".
There are three types of animation, see argument time.spacing.
Besides the on-screen plotting in the interactive R session, it is possible
and recommended to redirect the animation to an off-screen graphics
device using the contributed R package animation. For instance,
the animation can be watched and navigated in a web browser via
saveHTML (see Examples).
| 1 2 3 4 5 6 | 
| object | an object inheriting from class  | 
| interval | time range of the animation. | 
| time.spacing | time interval for the animation steps. | 
| nmax | maximum number of snapshots to generate. The default  | 
| sleep | numeric scalar specyfing the artificial pause in seconds between two
time points (using  | 
| pch, col | vectors of length equal to the number of event types specifying the point symbols and colors for events to plot (in this order). The vectors are recycled if necessary. | 
| legend.opts | either a list of arguments passed to the  | 
| timer.opts | either a list of arguments passed to the  
 Note that the argument  | 
| col.current | color of events when occuring (new). | 
| col.I | color once infectious. | 
| col.R | color event has once “recovered”. If  | 
| col.influence | color with which the influence region is drawn. Use
 | 
| main | optional main title placed above the map. | 
| verbose | logical specifying if a (textual) progress bar should
be shown during snapshot generation. This is especially useful if
the animation is produced within  | 
| ... | further graphical parameters passed to the plot-method of the
 | 
Sebastian Meyer with documentation contributions by Michael Höhle
plot.epidataCS for plotting the numbers of events by time
(aggregated over space) or the locations of the events in the
observation region W (aggregated over time).
The contributed R package animation.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | data("imdepi")
imdepiB <- subset(imdepi, type == "B")
# Animate the first year of type B with a step size of 7 days
animate(imdepiB, interval=c(0,365), time.spacing=7, nmax=Inf, sleep=0.1)
# Sequential animation of type B events during the first year
animate(imdepiB, interval=c(0,365), time.spacing=NULL, sleep=0.1)
# Animate the whole time range but with nmax=20 snapshots only
animate(imdepiB, time.spacing=NA, nmax=20, sleep=0.1)
# Such an animation can be saved in various ways using the tools of
# the animation package, e.g., saveHTML()
if (require("animation")) {
  oldwd <- setwd(tempdir())  # to not clutter up the current working dir
  saveHTML(animate(imdepiB, interval = c(0,365), time.spacing = 7),
           nmax = Inf, interval = 0.2, loop = FALSE,
           title = "Animation of the first year of type B events")
  setwd(oldwd)
}
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.