| tm_animate_fast | R Documentation |
Specify an animation from a tmap plot. This is similar to creating facets with tm_facets(). The animation subsequently can be exported to a gif or video file (e.g. mp4) with tmap_animation(). If the tmap plot with tm_animate() is printed, the animation will be previewed. The default tm_animate() will show the individual frames slowly (frame per seconds (fps) set to 2) whereas tm_animate_fast() will show them like a movie (with a fps set to 24).
tm_animate_fast(
frames = "VARS__",
nframes = 60L,
fps = 24L,
play = c("loop", "pingpong", "once"),
dpr = 2,
...
)
tm_animate(
frames = "VARS__",
nframes = 60L,
fps = 2L,
play = c("loop", "pingpong", "once"),
dpr = 2,
...
)
frames |
group by variable used to create the animation frames. This is similar to the |
nframes |
number of animation frames. So far, this only applied experimentally in transition map variables. See the extension package tmap.cartogram. |
fps |
frames per second. Default: 30 for |
play |
how should the animation be played? One of |
dpr |
device pixel ratio. The ratio between the physical pixel density of a device and its logical pixel density. |
... |
passed on to |
In older versions (< 4.1) tm_facets() with page specification was used to create animations frames and tmap_animation() to create the animation itself using inputs like the frame rate specification. As of version 4.2, the whole animation, including frame rate, is specified in tm_animate(). The animation can still be saved via tmap_animation().
if (interactive()) {
tm_shape(NLD_prov) +
tm_polygons("yellow") +
tm_animate(frames = "name")
tm_shape(metro) +
tm_symbols(size = paste0("pop", seq(1950, 2030, by=10)),
size.free = FALSE,
size.legend = tm_legend("Population")) +
tm_layout(panel.labels = seq(1970, 2030, by=10)) +
tm_animate()
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.