View source: R/2_ggproto_visualize.r
animate_plotly | R Documentation |
{plotly}
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, ...)
ggtour |
A grammar of graphics tour with appended protos added.
A return from |
fps |
Number of Frames Per Second, the speed resulting animation. |
... |
Other arguments passed to
|
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))
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)}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.