animate_plotly: Animate a ggtour as and HTML widget via '{plotly}'

Description Usage Arguments See Also Examples

View source: R/2_ggproto_visualize.r

Description

Animates the static ggtour() and added proto_*() functions as a {plotly} animation, an .html widget with slider and hover tooltip showing the row number.

Usage

1

Arguments

ggtour

A grammar of graphics tour with appended protos added. A return from ggtour() + proto_*().

fps

Scalar number of Frames Per Second, the speed the animation should play at.

...

Other arguments passed to plotly::layout.

See Also

plotly::ggplotly

Other ggtour animator: animate_gganimate()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
dat <- scale_sd(tourr::flea[, 1:6])
clas <- tourr::flea$species
bas <- basis_pca(dat)
mv <- manip_var_of(bas)
mt_path <- manual_tour(bas, manip_var = mv)

ggt <- ggtour(mt_path, dat, angle = .1) +
  proto_origin() +
  proto_basis() +
  proto_point(aes_args = list(color = clas, shape = clas),
              identity_args = list(size = 1.5, alpha = .7))
## Not run: 
animate_plotly(ggtour)

## Example saving plotly to a .html widget, may require additional setup.
if(F){
  anim <- animate_plotly(ggtour, fps = 10)
  htmlwidgets::saveWidget(widget = anim, file = "./figures/my_tour.html",
                          selfcontained = TRUE)}
## End(Not run)

spinifex documentation built on Sept. 28, 2021, 5:09 p.m.