Learn R Programming

spinifex (version 0.3.2)

play_tour_path: 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

Run this code
# NOT RUN {
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 {
play_tour_path(tour_path = g_path, data = dat_std)

play_tour_path(tour_path = g_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(F){ ## Don't run by mistake
  ## Export plotly .html widget
  play_tour_path(tour_path = tpath, data = dat_std,
                 render_type = render_plotly,
                 html_filename = "myRadialTour.html")
               
  ## Export gganimate .gif
  play_tour_path(tour_path = tpath, data = dat_std,
                 render_type = render_gganimate,
                 gif_path = "myOutput", gif_filename = "myRadialTour.gif")
}
# }

Run the code above in your browser using DataLab