Learn R Programming

surveillance (version 1.8-0)

epidataCS_plot: Plotting the Events of an Epidemic over Time and Space

Description

The plot method for class "epidataCS" either plots the number of events along the time axis (epidataCSplot_time) as a hist(), or the locations of the events in the observation region W (epidataCSplot_space).

Usage

## S3 method for class 'epidataCS':
plot(x, aggregate = c("time", "space"), subset, ...)

epidataCSplot_time(x, subset, t0.Date = NULL, freq = TRUE, col = rainbow(nTypes), cumulative = list(), add = FALSE, mar = NULL, xlim = NULL, ylim = NULL, xlab = "Time", ylab = NULL, main = NULL, panel.first = abline(h=axTicks(2), lty=2, col="grey"), legend.types = list(), ...)

epidataCSplot_space(x, subset, cex.fun = sqrt, points.args = list(), add = FALSE, legend.types = list(), legend.counts = list(), ...)

Arguments

x
an object of class "epidataCS".
aggregate
character, one of "time" and "space", referring to the specific plot functions epidataCSplot_time and epidataCSplot_time, respectively. For "time", the number of events over time
subset
logical expression indicating a subset of events to consider for plotting: missing values are taken as false. Note that the expression is evaluated in the events data frame x$events@data, which means that column names can be refer
...
in the basic plot-method further arguments are passed to the aggregate-specific plot function. In epidataCSplot_time, further graphical parameters are passed to hist
t0.Date
the beginning of the observation period t0 = x$stgrid$start[1] as a "Date" (or anything coercible by as.Date without further arguments), enabling a nice x-axis using
freq
see hist, defaults to TRUE.
col
fill colour for the bars of the histogram, defaults to the vector of rainbow colours.
cumulative
if a list (of style options), lines for the cumulative number of events (per type) will be added to the plot. Possible options are axis (logical), lab (axis label), maxat (single integer affecting the
add
logical (default: FALSE) indicating if the plot should be added to an existing window.
mar
see par. The default (NULL) is mar <- par("mar"), with mar[4] <- mar[2] if an axis is requested for the cumulative numbers.
xlim,ylim
NULL provides automatic axis limits.
xlab,ylab
axis labels (with sensible defaults).
main
main title of the plot (defaults to no title).
panel.first
expression that should be evaluated after the plotting window has been set up but before the histogram is plotted. Defaults to adding horizontal grid lines.
legend.types
if a list (of arguments for legend), a legend for the event types is added to the plot.
cex.fun
function which takes a vector of counts of events at each unique location and returns a (vector of) cex value(s) for the sizes of the corresponding points. Defaults to the sqrt() function, which for the d
points.args
a list of (type-specific) graphical parameters for points, specifically pch, lwd, and col, which are all recycled to give the length nlevels(x$events$
legend.counts
if a list (of arguments for legend), a legend illustrating the effect of cex.fun is added to the plot. This list may contain a special element counts, which is an integ

Value

  • For aggregate="time" (i.e., epidataCSplot_time) the data of the histogram (as returned by hist), and for aggregate="space" (i.e., epidataCSplot_space) NULL, invisibly.

See Also

animate.epidataCS

Examples

Run this code
data("imdepi")

## show the occurrence of events along the time axis (-> histogram)
plot(imdepi, "time", main = "Histogram of event time points")

## show the distribution in space
plot(imdepi, "space", lwd=2)

Run the code above in your browser using DataLab