play_tour_path: Animates the provided tour path.

View source: R/zDepricated_3_visualize.r

play_tour_pathR Documentation

Animates the provided tour path.

Description

[Superseded], see ggtour. Takes the result of tourr::save_history() or manual_tour(), interpolates over the path and renders into a specified render_type.

Usage

play_tour_path(
  tour_path,
  data = NULL,
  angle = 0.05,
  render_type = render_plotly,
  ...
)

Arguments

tour_path

The result of tourr::save_history() or manual_tour().

data

Optional, number of columns must match that of tour_path.

angle

Target distance (in radians) between steps. Defaults to .05.

render_type

Graphics to render to. Defaults to render_plotly, alternative use render_gganimate.

...

Optionally pass additional arguments to render_ and the function used in render_type.

See Also

render_ For arguments to pass into ....

Examples

library(spinifex)
message("It's suggested to switch to the proto api, see `?ggtour` to get started.")

dat_std <- scale_sd(wine[, 2:6])
clas    <- wine$Type
bas     <- basis_pca(dat_std)
gt_path <- save_history(dat_std, tour_path = tourr::grand_tour(), max = 5)

## Not run: 
suppressWarnings(
  play_tour_path(tour_path = gt_path, data = dat_std)
)

suppressWarnings(
  play_tour_path(tour_path = gt_path, data = dat_std,
                 axes = "bottomleft", angle = .08, fps = 8,
                 aes_args = list(color = clas, shape = clas),
                 identity_args = list(size = 1.5, alpha = .7),
                 ggproto = 
                   list(ggplot2::theme_void(), ggplot2::ggtitle("My title")),
                 render_type = render_gganimate)
)

## Saving a .gif(may require additional setup)
if(FALSE){ ## Don't accidentally save file
  ## Export plotly .html widget
  play_tour_path(tour_path = gt_path, data = dat_std,
                 render_type = render_plotly,
                 html_filename = "myRadialTour.html")
               
  ## Export gganimate .gif
  play_tour_path(tour_path = gt_path, data = dat_std,
                 render_type = render_gganimate,
                 gif_path = "myOutput", gif_filename = "myRadialTour.gif")
}

## End(Not run)

spinifex documentation built on May 29, 2024, 1:23 a.m.