17 Animations
17.1 Creating animations
tm = tm_shape(slo_borders) +
tm_borders() +
tm_shape(slo_regions_ts) +
tm_polygons("gdppercap")
tm +
tm_animate(by = "time")
tm +
tm_animate_fast(by = "time")
tm +
tm_animate(by = "time", fps = 5, play = "pingpong")
library(stars)
slo_tavg = read_stars("data/slovenia/slo_tavg.tif")
tm_shape(slo_tavg) +
tm_raster() +
tm_animate(by = "band", fps = 6)
#> [scale] tm_raster:() the data variable assigned to 'col' contains positive and negative values, so midpoint is set to 0. Set 'midpoint = NA' in 'fill.scale = tm_scale_intervals(<HERE>)' to use all visual values (e.g. colors)
17.2 Saving animations
tma1 = tm +
tm_animate_fast(by = "time")
tmap_animation(tma1, "tma1.gif")