View source: R/stsplot_spacetime.R
stsplot_spacetime | R Documentation |
For each period (row) or for the overall period of the
observed
matrix of the "sts"
object, a map
showing the counts by region is produced.
It is possible to redirect the output into files, e.g., to generate an
animated GIF.
stsplot_spacetime(x, type, legend = NULL, opts.col = NULL, labels = TRUE,
wait.ms = 250, cex.lab = 0.7, verbose = FALSE,
dev.printer = NULL, ...)
x |
an object of class |
type |
a formula (see |
legend |
a
If |
opts.col |
a
|
labels |
Boolean whether to add labels |
wait.ms |
Number of milliseconds to wait between each plot |
cex.lab |
|
verbose |
Boolean whether to write out extra information |
dev.printer |
Either |
... |
Extra arguments sent to the plot function. |
The animate.sts
method provides a
re-implementation and supersedes this function!
Michael Höhle
Other stsplot
types, and animate.sts
for
the new implementation.
data("ha.sts")
print(ha.sts)
## Not run:
# map of total counts by district (compare old vs. new implementation)
plot(ha.sts, type = observed ~ 1 | unit) # deprecated
plot(ha.sts, type = observed ~ unit, labels = TRUE)
# space-time animation
plot(aggregate(ha.sts,nfreq=13), type = observed ~ 1 | unit * time)
#print the frames to a png device
#and do the animation without extra sleeping between frames
imgname <- file.path(tempdir(), "berlin")
plot(aggregate(ha.sts,nfreq=13), type = observed ~ 1 | unit * time,
wait.ms=0, dev.printer=list(name=imgname))
#Use ImageMagick (you might have to adjust the path to 'convert')
system(paste0("convert -delay 50 ", imgname,
"*.png ", imgname, "-animated.gif"))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.