, see ggtour
.
Takes the result of array2df()
and animations them via {plotly}
into a self-contained HTML widget.
render_plotly(fps = 8, html_filename = NULL, save_widget_args = list(), ...)
Frames animated per second. Defaults to 8.
Optional, saves the plotly object as an HTML widget to
this string (without the directory path).
Defaults to NULL (not saved). For more output control use save_widget_args
or call htmlwidgets::saveWidget()
on a return object of render_plotly()
.
A list of arguments to be called in
htmlwidgets::saveWidget()
when used with a html_filename
.
Passes arguments to render_(...)
.
render_
for ...
arguments.
ggplotly
for source documentation of tooltip
.
saveWidget
for more control of .html output.
library(spinifex)
message("It's suggested to switch to the proto api, see `?ggtour` to get started.")
#> It's suggested to switch to the proto api, see `?ggtour` to get started.
## Setup
dat_std <- scale_sd(wine[, 2:6])
clas <- wine$Type
bas <- basis_pca(dat_std)
mv <- manip_var_of(bas)
mt_array <- manual_tour(basis = bas, manip_var = mv)
mt_df_ls <- array2df(basis_array = mt_array, data = dat_std)
# \donttest{
render_plotly(frames = mt_df_ls)
require("ggplot2")
render_plotly(
frames = mt_df_ls, axes = "bottomleft", fps = 10,
aes_args = list(color = clas, shape = clas),
identity_args = list(size = 1.5, alpha = .7),
ggproto = list(theme_bw(), scale_color_brewer(palette = "Set2")))
## Saving a .gif, may require additional setup
if(FALSE) ## Don't accidentally save file
render_plotly(frames = mt_df_ls, axes = "bottomleft", fps = 10,
html_filename = "myRadialTour.html")# }