Animated maps solve these issues.Although they depend on digital publication, this is becoming less of an issue as more and more content moves online.Animated maps can still enhance paper reports: you can always link readers to a web-page containing an animated (or interactive) version of a printed map to help make it come alive.There are several ways to generate animations in R, including with animation packages such as gganimate, which builds on ggplot2 (see Section ).This section focusses on creating animated maps with tmap because its syntax will be familiar from previous sections and the flexibility of the approach.
Figure 8.16: Animated map showing the top 30 largest urban agglomerations from 1950 to 2030 based on population projects by the United Nations. Animated version available online at: geocompr.robinlovelace.net.
The resulting urb_anim
represents a set of separate maps for each year.The final stage is to combine them and save the result as a .gif
file with .The following command creates the animation illustrated in Figure 8.16, with a few elements missing, that we will add in during the exercises:
Figure 8.17: Animated map showing population growth, state formation and boundary changes in the United States, 1790-2010. Animated version available online at geocompr.robinlovelace.net.