Learn R Programming

terra (version 1.7-55)

animate: Animate a SpatRaster

Description

Animate (sequentially plot) the layers of a SpatRaster to create a movie.

This does not work with R-Studio.

Usage

# S4 method for SpatRaster
animate(x, pause=0.25, main, range, maxcell=50000, n=1, ...)

Value

None

Arguments

x

SpatRaster

pause

numeric. How long should be the pause be between layers?

main

title for each layer. If not supplied the z-value is used if available. Otherwise the names are used.

range

numeric vector of length 2. Range of values to plot

maxcell

positive integer. Maximum number of cells to use for the plot. If maxcell < ncell(x), spatSample(type="regular") is used before plotting

n

integer > 0. Number of loops

...

Additional arguments passed to plot

See Also

Examples

Run this code
s <- rast(system.file("ex/logo.tif", package="terra"))   
animate(s, n=1)

Run the code above in your browser using DataLab