display-methods {surveillance} | R Documentation |
Display methods for objects of class "sts"
.
The plotting of time-series plots relies on two internal functions
with plot.sts.time.one
being the work-horse. Its arguments are
(almost) similiar to plot.survRes
. k
is the
column to plot.
plot.sts.time(x, type,method=x@control$name,disease=x@control$data,same.scale=TRUE,par.list=list(mfrow=magic.dim(nAreas),mar=par()$mar),...)
plot.sts.time.one(x, k=1,domany=FALSE,ylim=NULL,xaxis.years=TRUE, xaxis.unit=TRUE, xlab="time", ylab="No. infected", main=NULL,type="s",lty=c(1,1,2),col=c(NA,1,4), lwd=c(1,1,1), outbreak.symbol = list(pch=3,col=3, cex=1),alarm.symbol=list(pch=24, col=2, cex=1),cex=1,legend.opts=list(x="top", legend=NULL,lty=NULL,pch=NULL,col=NULL),dx.upperbound=0.5,hookFunc=function() {},...)
For spacetime plots the following internal function does all the work:
plot.sts.spacetime(x,type,legend=NULL,opts.col=NULL,labels=TRUE,wait.ms=250,cex.lab=0.7,verbose=FALSE,dev.printer=NULL,...)
print
is the method for printing sts
objects.
The methods are called for their side-effects.
plot(x,y,type,...) print(x,...)
"sts"
observed ~ time
x
are
aggregated over units and the resulting univariate time-series
is plotted. The plotting is done by the function
plot.time.sts
, which takes the same arguments as the
plot.survRes
function.observed ~ time | unit
dim(x)
plots
with each showing the time-series of one observational
unit. The actual plotting is done by the function
plot.time.sts.one
observed ~ 1 | unit
x@observed
object are
used to label the entries of the x@map
. Regions with an
alarm are shaded.observed ~ 1 | unit * time
nrow(x)
frames is generated. Each frame contains the
number of counts per region for the current row in the
observed
matrix. It is possible to redirect the output
into files, e.g. to generate an animated GIF. See the
examples.sts
object. For each time point and each
series it is shown whether there is an alarm. In case of
hierarchical surveillance the user can pass
an additional argument lvl
, which is a vector of the
same length as rows in x
specifying for each time series
its level.
plot
,
in case of printing these are passed to print.default
data(ha) shp <- system.file("shapes/berlin.shp",package="surveillance") has4 <- disProg2sts(ha, map=readShapePoly(shp,IDvar="SNAME")) print(has4) plot(has4, type= observed ~ time) plot(has4, type= observed ~ time | unit) plot(has4, type= observed ~ 1 | unit) plot(has4[1:20,1:2], type= observed ~ 1 | unit) plot(aggregate(has4,nfreq=13), type= observed ~ 1 | unit * time) ## Not run: #Configure a png device printer for the plot command dev.printer <- list(device=png,extension=".png",width=640,height=480,name="/tmp/berlin") #Do the animation plot(aggregate(has4,nfreq=13), type = observed ~ 1 | unit * time, dev.printer=dev.printer) #Use ImageMagick -- replace /sw/bin/convert by your path to convert system(paste("/sw/bin/convert -delay 50 ",dev.printer$name,"*.png /tmp/animated.gif",sep="")) ## End(Not run)