I make mpeg videos using the code below. r.mean is a spatRaster (the format for rasters in the terra package)
library(terra)
animation::saveVideo(animate(r.mean, n=1, pause = 0, sub = title_animate, col = rev(colorList), videoName_out))
I have included a screenshot of one frame of the animation. There is lots of white space above and below the actual image. I'd like to set the y range from -60 to 90. I've seen one example of use of saveVideo that looks like this with par parameters included in {}
saveVideo({
par(xxx, yy, zzz)},
some other stuff)
But I haven't had any luck making that work.
When asking an R question, please provide a minimal, self-contained, reproducible examples (as I do below).
Example data
library(terra)
r <- rast(nlyrs=3)
values(r) <- rep(1:3, ncell(r))
You can use the ani.height
and ani.width
arguments.
animation::saveGIF(animate(r, n=1), ani.height=200, ani.width=300)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.