Learn R Programming

surveillance (version 1.8-0)

stsplot_space: Map of Disease Incidence During a Given Period

Description

This is the plot variant of type=observed~unit for "sts" objects, i.e., plot(stsObj, type=observed~unit, ...) calls the function documented below. It produces an spplot where regions are color-coded according to disease incidence (either absolute counts or relative to population) during a given time period.

Usage

stsplot_space(x, tps = NULL, map = x@map, population = NULL,
              main = NULL, labels = FALSE, at = 10, col.regions = NULL,
              colorkey = list(space = "bottom", labels = list(at=at)),
              total.args = NULL, sp.layout = NULL, ...)

Arguments

x
an object of class "sts" or a matrix of counts, i.e., observed(stsObj), where especially colnames(x) have to be contained in row.names(map). If a matrix, the
tps
a numeric vector of one or more time points. The unit-specific sum over all time points tps is plotted. The default tps=NULL means cumulation over the whole time period 1:nrow(x).
map
an object inheriting from "SpatialPolygons" representing the ncol(x) regions. By default the map slot of x is queried (which might be empty and is not applicable if
population
an optional numeric vector of population numbers in the ncol(x) regions. If given, incidence values instead of absolute counts are plotted.
main
a main title for the plot. If NULL and x is of class "sts", the time range of tps is put as the main title.
labels
determines if and how regions are labeled. A FALSE (default) or NULL value omits region labels. labels=TRUE uses row.names(map). Alternatively, labels can also be a character or
at
either a number of levels (default: 10) for the categorization (color-coding) of counts, or specific break points to use, or a named list of a number of levels ("n"), a transformer ("trafo") of class "
col.regions
a vector of fill colors of length length(at)-1.
colorkey
a list describing the color key, see levelplot. The default list elements will be updated by the provided list using modifyList.
total.args
an optional list of arguments for grid.text to have the overall number/incidence of cases printed at an edge of the map. The default settings are list(label="Overall: ", x=1, y=0)
sp.layout
optional list of additional layout items, see spplot.
...
further arguments for spplot.

Value

See Also

the central stsplot-documentation for an overview of plot types, and animate.sts for animations of "sts" objects.

Examples

Run this code
data("measlesWeserEms")

# default plot: total region-specific counts over all weeks
plot(measlesWeserEms, type=observed~unit)

# compare with old implementation
plot(measlesWeserEms, type=observed~1|unit)

# plot incidence with region labels
plot(measlesWeserEms, type=observed~unit,
     population=measlesWeserEms@map$POPULATION / 100000,
     labels=list(labels="GEN", cex=0.7, font=3))

# counts in the first week of the second year only (+ display overall)
plot(measlesWeserEms, type=observed~unit, tps=53, total.args=list())

Run the code above in your browser using DataLab