Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

plot.disProg

Plot Generation of the Observed and the Defined Outbreak States of a (Multivariate) Time Series


Description

Plotting a (multivariate) disProg object. The internal function plot.disProg.one is used as a helper function to plot a univariate time series.

Usage

## S3 method for class 'disProg'
plot(x, title = "", xaxis.years=TRUE, startyear = x$start[1],
    firstweek = x$start[2], as.one=TRUE, same.scale=TRUE, ...)

  plot.disProg.one(x, title = "", xaxis.years=TRUE, quarters=TRUE, 
    startyear =  x$start[1], firstweek = x$start[2], ylim=NULL, xlab="time",
    ylab="No. infected",type="hh",lty=c(1,1),col=c(1,1), 
    outbreak.symbol = list(pch=3, col=3), legend.opts=list(x="top", 
    legend=c("Infected", "Outbreak"), lty=NULL,pch=NULL,col=NULL), ...)

Arguments

x

object of class disProg

title

plot title

xaxis.years

if TRUE, the x axis is labeled using years

quarters

add quarters to the plot

startyear

year to begin the axis labeling (the year where the oldest data come from). This arguments will be obsolete in sts.

firstweek

number of the first week of January in the first year (just for axis labeling grounds)

as.one

if TRUE all individual time series are shown in one plot

same.scale

if TRUE all plots have same scale

ylim

range of y axis

xlab

label of the x-axis

ylab

label of the y-axis

type

line type of the observed counts (should be hh)

lty

line type of the observed counts

col

color of the observed count lines

outbreak.symbol

list with entries pch and col specifying the plot symbol

legend.opts

a list containing the entries to be sent to the legend function. If no legend is requested use legend.opts=NULL. Otherwise, the following arguments are default

x

top

legend

The names infected and outbreak

lty

If NULL the lty argument will be used

pch

If NULL the pch argument is used

col

If NULL the col argument is used

An further arguments to the legend function are just provided as additional elements of this list, e.g. horiz=TRUE.

...

arguments passed to plot.disProg.one. From there, further arguments are passed to matplot.

Value

a plot showing the number of infected and the defined alarm status for a time series created by simulation or given in data either in one single plot or in several plots for each individual time series.

Author(s)

M. Höhle with contributions by A. Riebler and C. Lang

Examples

# Plotting of simulated data
disProgObj <- sim.pointSource(p = 0.99, r = 0.5, length = 208,
                              A = 1, alpha = 1, beta = 0, phi = 0,
                              frequency = 1, state = NULL, K = 5)
# plot the simulated disease with the defined outbreaks
plot(disProgObj)
title <- "Number of Infected and Defined Outbreak Positions for Simulated Data"
plot(disProgObj, title = title)
plot(disProgObj, title = title, xaxis.years=TRUE,
     startyear = 1999, firstweek = 13)
plot(disProgObj, title = title, xaxis.years=TRUE,
     startyear = 1999, firstweek = 14)

# Plotting of measles data
data(measles.weser)
# one plot
plot(measles.weser, title = "measles cases in the district Weser-Ems",
     xaxis.years=TRUE, startyear= 2001, firstweek=1)
# plot cases for each "Kreis" 
plot(measles.weser, same.scale=TRUE, as.one=FALSE)

surveillance

Temporal and Spatio-Temporal Modeling and Monitoring of Epidemic Phenomena

v1.19.1
GPL-2
Authors
Michael H<f6>hle [aut, ths] (<https://orcid.org/0000-0002-0423-6702>), Sebastian Meyer [aut, cre] (<https://orcid.org/0000-0002-1791-9449>), Michaela Paul [aut], Leonhard Held [ctb, ths], Howard Burkom [ctb], Thais Correa [ctb], Mathias Hofmann [ctb], Christian Lang [ctb], Juliane Manitz [ctb], Andrea Riebler [ctb], Daniel Saban<e9>s Bov<e9> [ctb], Ma<eb>lle Salmon [ctb], Dirk Schumacher [ctb], Stefan Steiner [ctb], Mikko Virtanen [ctb], Wei Wei [ctb], Valentin Wimmer [ctb], R Core Team [ctb] (A few code segments are modified versions of code from base R)
Initial release
2021-03-30

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.