Learn R Programming

tourr (version 1.1.0)

render_gif: Render frames of animation to a gif file

Description

Render frames of animation to a gif file

Usage

render_gif(
  data,
  tour_path,
  display,
  gif_file = "animation.gif",
  ...,
  apf = 1/10,
  frames = 50,
  rescale = FALSE,
  sphere = FALSE,
  start = NULL,
  loop = TRUE
)

Arguments

data

matrix, or data frame containing numeric columns

tour_path

tour path generator

display

the method used to render the projected data, e.g. display_xy, display_pcp

gif_file

Name of gif file (default = "animation.gif")

...

other options passed to png

apf

angle (in radians) per frame

frames

number of frames in output

rescale

default FALSE. If TRUE, rescale all variables to range [0,1]

sphere

if true, sphere all variables

start

starting projection. If NULL, uses path default.

loop

Logical for gifski to loop or not, default=TRUE

Examples

Run this code
if (FALSE) {
# gifski needs to be installed to render a gif
if (requireNamespace("gifski", quietly = TRUE)) {
  gif_file <- file.path(tempdir(), "test.gif")
  render_gif(flea[, 1:6], grand_tour(), display_xy(), gif_file)
  utils::browseURL(gif_file)
  unlink(gif_file)
}
}

Run the code above in your browser using DataLab