9.9 Animated Maps

# create animation
urb_anim = tm_shape(world) + tm_polygons() + 
  tm_shape(urban_agglomerations) + tm_dots(size = "population_millions") +
  tm_facets(along = "year", #the main change
            free.coords = FALSE) #still important

# save animation file
tmap_animation(urb_anim, 
               filename = "urb_anim.gif", 
               delay = 25)

Urban Areas

USA Populations over Time