Learn R Programming

spinifex (version 0.2.5)

play_manual_tour: Animate a manual tour

Description

Performs the a manual tour and returns an animation of render_type. For use with tourr::save_history() tour paths see play_tour_path().

Usage

play_manual_tour(
  basis = NULL,
  data,
  manip_var,
  render_type = render_plotly,
  rescale_data = FALSE,
  theta = NULL,
  phi_min = 0L,
  phi_max = 0.5 * pi,
  angle = 0.05,
  ...
)

Arguments

basis

A (p, d) orthonormal numeric matrix. The linear combination the original variables contribute to projection space. Defaults to NULL, generating a random basis.

data

(n, p) dataset to project, consisting of numeric variables.

manip_var

Integer column number or string exact column name of the. variable to manipulate. Required, no default.

render_type

Which graphics to render to. Defaults to render_plotly,

rescale_data

When TRUE scales the data to between 0 and 1.

theta

Angle in radians of "in-plane" rotation, on the xy plane of the reference frame. Defaults to theta of the basis for a radial tour.

phi_min

Minimum value phi should move to. Phi is angle in radians of the "out-of-plane" rotation, the z-axis of the reference frame. Required, defaults to 0.

phi_max

Maximum value phi should move to. Phi is angle in radians of the "out-of-plane" rotation, the z-axis of the reference frame. Required, defaults to pi/2.

angle

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

...

Optionally pass additional arguments to the render_type for projection point aesthetics; geom_point(aes(...)). OR passes optional arguments to manual_tour,

Value

An animation of a radial tour.

Examples

Run this code
# NOT RUN {
flea_std <- tourr::rescale(tourr::flea[, 1:6])
rb <- tourr::basis_random(n = ncol(flea_std))
class <- tourr::flea$species

# }
# NOT RUN {
play_manual_tour(basis = rb, data = flea_std, manip_var = 4)

play_manual_tour(basis = rb, data = flea_std, manip_var = 6, theta = .5 * pi,
                 render_type = render_gganimate, col = class, pch = class, 
                 axes = "bottomleft", fps = 5)
# }

Run the code above in your browser using DataLab