| plot_map | R Documentation |
Plot of a map showing a speficied indicator (such as incidence) from an infpan object.
plot_map(
object,
attribute = "Cases",
timepoint = NULL,
verbose = FALSE,
...
)
object |
object of class |
attribute |
Attribute to be plotted, must be defined in |
timepoint |
Time point for which the attribute is to be plotted |
verbose |
|
... |
Further graphic arguments passed to |
Plots a map from an infpan object which displays the attribute specified with the attribute parameter
at the timepoint specified with timepoint.
To adjust the layout of the map, use the ... parameters which are passed to the
plot S3 method for the sf class (see the corresponding documentation).
Map plot requires geodata to be specified in the infpan object (Use add_geodata to
assign your sf object).
Permitted attributes are: "Cases", "R_t" (Effective reproduction number), "Cum. cases" (Cumulative cases),
"Incidence" Incidence (per xxx pop), "Population" (Population size of the region),
"Roll. mean" (Rolling mean of cases), and "Roll. sum" (Rolling sum of cases).
Input infpan object (unchanged), plot
Thomas Wieland
Wieland T (2020) Flatten the Curve! Modeling SARS-CoV-2/COVID-19 Growth in Germany at the County Level. REGION 7(2), 43–83. \Sexpr[results=rd]{tools:::Rd_expr_doi("https://doi.org/10.18335/region.v7i2.324")}
infpan-class,
load_infections_paneldata,
calculate_incidence,
calculate_cum,
calculate_rollmean,
calculate_rollsum,
calculate_Rt
data(COVID19Cases_geoRegion)
# Get SWISS COVID19 cases at NUTS 3 level
data(K4kant20260101gf_ch2007Poly)
# Cantonal boundaries of Switzerland
COVID19Cases_geoRegion <-
COVID19Cases_geoRegion[!COVID19Cases_geoRegion$geoRegion %in% c("CH", "CHFL"),]
# Exclude CH = Switzerland total and CHFL = Switzerland and Liechtenstein total
COVID19Cases_geoRegion <-
COVID19Cases_geoRegion[COVID19Cases_geoRegion$datum <= "2020-05-31",]
# Extract first COVID-19 wave
infpan_CH <- load_infections_paneldata(
data = COVID19Cases_geoRegion,
col_cases = "entries",
col_date = "datum",
col_region = "geoRegion",
other_cols = c("Population" = "pop"),
verbose = TRUE
)
# Import as infections panel data set (class infpan)
infpan_CH <- calculate_incidence(
infpan_CH,
col_name = "incidence",
verbose = TRUE
)
# Calculate incidence of cases as "incidence"
infpan_CH <- add_geodata(
infpan_CH,
K4kant20260101gf_ch2007Poly,
unit_col = "cant_abbrev"
)
# Adding geodata (sf) to infpan object
summary(infpan_CH)
# Summary of infpan object
timestamps(infpan_CH)
# Time stamps of infpan object
plot_map(
infpan_CH,
attribute = "Incidence",
main = "COVID-19 Incidence 2020-05-31",
breaks = c(0, 0.05, 0.1, 0.2, 1),
verbose = TRUE
)
# Simple map of incidence for the most current date (timepoint=NULL)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.