Animates the static ggtour()
and added proto_*()
functions as a
{plotly}
animation, an .html widget with slider and hover tooltip showing
the row number.
animate_plotly(ggtour, fps = 8, ...)
A grammar of graphics tour with appended protos added.
A return from ggtour() + proto_*()
.
Number of Frames Per Second, the speed resulting animation.
Other arguments passed to
plotly::ggplotly
.
Other ggtour animator:
animate_gganimate()
,
filmstrip()
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_origin() +
proto_basis() +
proto_point(aes_args = list(color = clas, shape = clas),
identity_args = list(size = 1.5, alpha = .7))
# \donttest{
animate_plotly(ggt, width = 700, height = 450) ## pixels only, no resolution argument
## Example saving to a .html widget, may require additional setup.
if(FALSE){
anim <- animate_plotly(ggt, fps = 10,
width = 700, height = 450) ## in pixels
htmlwidgets::saveWidget(widget = anim,
file = "./figures/my_tour.html",
selfcontained = TRUE)}
# }