# NOT RUN {
library(spinifex)
dat <- scale_sd(penguins[, 1:4])
clas <- penguins$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))
# }
# NOT RUN {
animate_gganimate(ggt)
if(F){ ## Don't accidentally save file
## Alternative arguments storing to a variable for saving
anim <- animate_gganimate(
ggt, fps = 10, rewind = TRUE,
start_pause = 1, end_pause = 2,
height = 6, width = 10, units = "cm", ## "px", "in", "cm", or "mm."
res = 150)
## Save rendered animation as .gif
gganimate::anim_save("my_tour.gif",
animation = anim,
path = "./figures")
## Alternative renderer saving directly as an .mp4
animate_gganimate(ggt,
height = 10, width = 18, units = "cm", ## "px", "in", "cm", or "mm."
res = 150, ## resolution, not the same as dpi, 100 seems about 1x zoom
render = gganimate::av_renderer("./my_tour.mp4")) ## Alternative render
}
# }
Run the code above in your browser using DataLab