diff --git a/R/tm_animate.R b/R/tm_animate.R index f3fb9315..012fd24f 100644 --- a/R/tm_animate.R +++ b/R/tm_animate.R @@ -1,13 +1,13 @@ #' Specify an animation #' -#' Specify an animation from a tmap plot. This is similar to creating facets with [tm_facets()]. In stead of showing the facets next to each other, they are shown as animation frames. The animation subsequently 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). +#' Specify an animation from a tmap plot. This is similar to creating facets with [tm_facets()]. Instead of showing facets next to each other, they are shown as animation frames. 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). #' #' @description `tm_animate` #' #' @param by group by variable used to create the animation frames. Note: it is called `pages` in the core function [tm_facets()]. #' @param nframes number of animation frames. So far, this only applied experimentally in transition map variables. See the extension package tmap.cartogram. #' @param fps frames per second. Default: 30 for `tm_facets_animate` and 2 for `tm_facets_animate_slow`. -#' @param play how should the animation be played? One of `"loop"`, `"pingpong"`, and `"once"` +#' @param play how should the animation be played? One of `"loop"` (default), `"pingpong"`, and `"once"`, where `"loop"` means that the animation will loop indefinitely, `"pingpong"` means that it will play forward and then backward, and `"once"` means that it will play only once. #' @param dpr device pixel ratio. The ratio between the physical pixel density of a device and its logical pixel density. #' @param ... passed on to [tm_facets()] #' @export diff --git a/R/tmap_animation.R b/R/tmap_animation.R index 278eb4b8..1fced8c1 100644 --- a/R/tmap_animation.R +++ b/R/tmap_animation.R @@ -3,8 +3,8 @@ #' Create a gif animation or video from an animated tmap plot. First use [tm_animate()] or [tm_animate_fast()] to animate the plot, and then apply [tmap_animation()] to save it as a gif or video file (e.g. mp4). #' #' @param tm tmap or a list of tmap objects. If `tm` is a tmap object, -#' facets should be created, where `nrow` and `ncol` in [tm_facets()] have to -#' be set to 1 in order to create one map per frame. +#' animation frames should be created using either [tm_animate()] or +#' [tm_animate_fast()]. #' @param filename filename. If omitted (default), the animation will be shown #' in the viewer or browser. If specified, it should be a gif file or a video #' file (i.e. mp4). The package `gifski` is required to create a gif animation. diff --git a/man/tm_animate.Rd b/man/tm_animate.Rd index 93ce7832..9835b3d1 100644 --- a/man/tm_animate.Rd +++ b/man/tm_animate.Rd @@ -30,7 +30,7 @@ tm_animate( \item{fps}{frames per second. Default: 30 for \code{tm_facets_animate} and 2 for \code{tm_facets_animate_slow}.} -\item{play}{how should the animation be played? One of \code{"loop"}, \code{"pingpong"}, and \code{"once"}} +\item{play}{how should the animation be played? One of \code{"loop"} (default), \code{"pingpong"}, and \code{"once"}, where \code{"loop"} means that the animation will loop indefinitely, \code{"pingpong"} means that it will play forward and then backward, and \code{"once"} means that it will play only once.} \item{dpr}{device pixel ratio. The ratio between the physical pixel density of a device and its logical pixel density.} @@ -40,7 +40,7 @@ tm_animate( \code{tm_animate} } \details{ -Specify an animation from a tmap plot. This is similar to creating facets with \code{\link[=tm_facets]{tm_facets()}}. In stead of showing the facets next to each other, they are shown as animation frames. The animation subsequently be exported to a gif or video file (e.g. mp4) with \code{\link[=tmap_animation]{tmap_animation()}}. If the tmap plot with \code{\link[=tm_animate]{tm_animate()}} is printed, the animation will be previewed. The default \code{\link[=tm_animate]{tm_animate()}} will show the individual frames slowly (frame per seconds (fps) set to 2) whereas \code{\link[=tm_animate_fast]{tm_animate_fast()}} will show them like a movie (with a fps set to 24). +Specify an animation from a tmap plot. This is similar to creating facets with \code{\link[=tm_facets]{tm_facets()}}. Instead of showing facets next to each other, they are shown as animation frames. The animation subsequently can be exported to a gif or video file (e.g. mp4) with \code{\link[=tmap_animation]{tmap_animation()}}. If the tmap plot with \code{\link[=tm_animate]{tm_animate()}} is printed, the animation will be previewed. The default \code{\link[=tm_animate]{tm_animate()}} will show the individual frames slowly (frame per seconds (fps) set to 2) whereas \code{\link[=tm_animate_fast]{tm_animate_fast()}} will show them like a movie (with a fps set to 24). } \seealso{ \code{\link[=tm_facets]{tm_facets()}} which is the core function, and \code{\link[=tmap_animation]{tmap_animation()}} used to save the animation diff --git a/man/tmap_animation.Rd b/man/tmap_animation.Rd index cd9faa82..6cc1ed72 100644 --- a/man/tmap_animation.Rd +++ b/man/tmap_animation.Rd @@ -18,8 +18,8 @@ tmap_animation( } \arguments{ \item{tm}{tmap or a list of tmap objects. If \code{tm} is a tmap object, -facets should be created, where \code{nrow} and \code{ncol} in \code{\link[=tm_facets]{tm_facets()}} have to -be set to 1 in order to create one map per frame.} +animation frames should be created using either \code{\link[=tm_animate]{tm_animate()}} or +\code{\link[=tm_animate_fast]{tm_animate_fast()}}.} \item{filename}{filename. If omitted (default), the animation will be shown in the viewer or browser. If specified, it should be a gif file or a video