Functions for plotting the evolution of epidemics. The
"summary.epidata" plots the numbers of susceptible, infectious and
recovered (= removed) individuals by step functions along the time axis. The
stateplot shows individual state changes along the time axis.
# S3 method for summary.epidata plot(x, lty = c(2, 1, 3), lwd = 2, col = c("#1B9E77", "#D95F02", "#7570B3"), 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 epidata plot(x, ...) stateplot(x, id, ...)
an object inheriting from class
"summary.epidata". In the former case, its summary is calculated
and the function continues as in the latter case. The
"epidata" is a simple wrapper for
plot.summary.epidata implemented as
vectors of length 3 containing the line types and widths, respectively, for
the numbers of susceptible, infectious and removed individuals (in this
order). By default, all lines have width 1 and the line types are dashed
(susceptible), solid (infectious) and dotted (removed), respectively. To
omit the drawing of a specific line, just set the corresponding entry in
lty to 0. The vectors are recycled if necessary. For information
about the different
lwd codes, see the help pages
vectors of length 3 containing the line colors for the numbers of
susceptible, infectious and removed individuals (in this order).
col.hor defines the color for the horizontal parts of the step
col.vert defines the color for its vertical parts.
col is just short for
col.hor = col and
col.vert = col. The default
col vector corresponds to
brewer.pal("Dark2",n=3) from the RColorBrewer package.
The vectors are recycled if necessary. For information about the possible
col, see the help pages of
axis labels, default to "Time" and "Number of individuals", respectively.
if this is a list (of arguments for the
a legend will be plotted. The defaults are as follows:
logical indicating if the final numbers of susceptible and removed
individuals should be indicated on the right axis. The default
x represents a SIR epidemic and
otherwise, i.e. if the epidemic is SI, SIS or SIRS.
an expression to be evaluated after the plot axes are set up but before any plotting takes place. By default, a standard grid is drawn.
either a list of arguments passed to the function
NA), in which case no
rug will be plotted.
By default, the argument
ticksize is set to 0.02,
is set to the color according to
which.rug (black if this is
quiet is set to
Note that the argument
x, which contains the
locations for the
rug is fixed internally and can not be modified.
which.rug (see below) determines the locations to mark.
By default, tick marks are drawn at the time points of infections.
Alternatively, one can choose to mark only
"susceptibilities" (i.e. state change from R to S) or
single character string or factor of length 1 specifying the individual for
stateplot should be established.
plot.summary.epidata: further graphical parameters passed to
cex.axis (etc.) and
plot.epidata: arguments passed to
stateplot: arguments passed to
id had no events during the
observation period). By default,
plot.epidata) invisibly returns the
matrix used for plotting, which contains the evolution of the three
stateplot invisibly returns the function, which was plotted,
typically of class
"stepfun", but maybe of class
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
Susceptible, 2 to Infectious and 3 to Removed.