render_plotly: Animation the frames as a HTML widget.

View source: R/zDepricated_2_render.r

render_plotlyR Documentation

Animation the frames as a HTML widget.

Description

[Superseded], see ggtour. Takes the result of array2df() and animations them via {plotly} into a self-contained HTML widget.

Usage

render_plotly(fps = 8, html_filename = NULL, save_widget_args = list(), ...)

Arguments

fps

Frames animated per second. Defaults to 8.

html_filename

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().

save_widget_args

A list of arguments to be called in htmlwidgets::saveWidget() when used with a html_filename.

...

Passes arguments to render_(...).

See Also

render_ for ... arguments.

ggplotly for source documentation of tooltip.

saveWidget for more control of .html output.

Examples

library(spinifex)
message("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)


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")

nspyrison/spinifex documentation built on Feb. 7, 2024, 1:10 p.m.