library(spinifex)
dat <- scale_sd(penguins_na.rm[, 1:4])
clas <- penguins_na.rm$species
bas <- basis_pca(dat)
mv <- manip_var_of(bas)
mt_path <- manual_tour(bas, manip_var = mv)
ggt <- ggtour(mt_path, dat, angle = .3) +
proto_default(aes_args = list(color = clas, shape = clas),
identity_args = list(size = 1.5, alpha = .7))
if (FALSE) {
## Default .gif rendering
animate_gganimate(ggt)
if(FALSE){ ## Don't accidentally save file
## Option arguments, rendering to default .gif
anim <- animate_gganimate(
ggt, fps = 10, rewind = TRUE,
start_pause = 1, end_pause = 2,
height = 10, width = 15, units = "cm", ## "px", "in", "cm", or "mm."
res = 200 ## resolution, pixels per dimension unit I think
)
## Save rendered animation
gganimate::anim_save("my_tour.gif",
animation = anim,
path = "./figures")
## Alternative renderer saving directly to .mp4
animate_gganimate(ggt, fps = 5,
height = 4, width = 6, units = "in", ## "px", "in", "cm", or "mm."
res = 200, ## resolution, pixels per dimension unit I think
renderer = gganimate::av_renderer("./my_tour.mp4"))
}
}
Run the code above in your browser using DataLab