data("ha.sts")
print(ha.sts)
if (FALSE) {
# 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"))
}
Run the code above in your browser using DataLab