plot
  methods for classes "epidata" and
  "summary.epidata" plots the numbers of susceptible, infectious and
  recovered (= removed) individuals by step functions along the time axis.  The
  function stateplot shows individual state changes along the time axis.## S3 method for class 'summary.epidata':
plot(x,
     lty = c(2, 1, 3), lwd = 2, col = 1, col.hor = col, col.vert = col,
     xlab = "Time", ylab = "Number of individuals",
     xlim = NULL, ylim = NULL, legend.opts = list(), do.axis4 = NULL,
     panel.first = grid(), rug.opts = list(),
     which.rug = c("infections", "removals", "susceptibility", "all"), ...)
## S3 method for class 'epidata':
plot(x, ...)stateplot(x, id, ...)
"epidata" or
    "summary.epidata".  In the former case, its summary is calculated
    and the function continues as in the latter case.  The plot method
    for class "epidata"<col.hor defines the color for the horizontal parts of the step
    function, whilst col.vertc(xmin, xmax) and
    c(ymin, ymax), respectively.  By default, these are chosen adequately
    to fit the time range of the epidemic and the number of individuals.legend function or
    NULL (or NA), in which case no legend will be plotted.  All
    necessary arguments have sensible defaults and need nNULL
    means TRUE, if x represents a SIR epidemic and FALSE
    otrug or
    NULL (or NA), in which case no rug will be plotted.
    By default, the argument ticksize is set "removals",
    "susceptibilities" (i.e. state change from R to S) or
    "all" events.stateplot should be established.plot.summary.epidata: further graphical parameters passed to 
    plot, lines and axis, e.g. main, las, 
    cex.axis (etc.) and mgp.
For ploplot.summary.epidata (and plot.epidata) invisibly returns the
  matrix used for plotting, which contains the evolution of the three
  counters.
stateplot invisibly returns the function, which was plotted,
  typically of class "stepfun", but maybe of class "function",
  if no events have been observed for the individual in question (then the
  function always returns the initial state).  The vertical axis of
  stateplot can range from 1 to 3, where 1 corresponds to
  Suscepible, 2 to Infectious and 3 to Removed.summary.epidata for the data, on which the plots are based.
animate.epidata for the animation of epidemics.data("fooepidata")
s <- summary(fooepidata)
# evolution of the epidemic
par(las = 1)
plot(s)
# stateplot
stateplot(s, id = "15", main = "Some individual event paths")
stateplot(s, id = "1", add = TRUE, col = 2)
stateplot(s, id = "20", add = TRUE, col = 3)
legend("topright", legend = c(15, 1, 20), title = "id", lty = 1, col = 1:3,
       inset = 0.1)Run the code above in your browser using DataLab