Learn R Programming

spinifex (version 0.1.0)

play_manual_tour: Render display of a manual tour

Description

Performs the sepicify manual tour and returns an animation of render_type. For use with tourr::save_history() tour paths see play_tour_path(). A wrapper function for manual_tour(), array2df(), and render_().

Usage

play_manual_tour(data, basis = NULL, manip_var, theta = NULL,
  phi_min = 0, phi_max = 0.5 * pi, angle = 0.05,
  manip_col = "blue", render_type = render_plotly, col = "black",
  pch = 20, axes = "center", fps = 3, init_rescale_data = FALSE,
  ...)

Arguments

data

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

basis

A (p, d) dim orthonormal numeric matrix. If it's left null, random basis will be used.

manip_var

Number of the column/dimension to rotate.

theta

Angle in radians of "in-plane" rotation, on the XY plane of the reference frame. If left NULL, will initialize the radial angle of the manip_var.`

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 bases.

manip_col

String of the color to highlight the manip_var.

render_type

Which graphics to render to. Defaults to render_plotly, alternative use render_gganimate.

col

Color of the projected points. Defaults to "black".

pch

Point character of the projected points. Defaults to 20.

axes

Position of the axes: "center", "bottomleft" or "off". Defaults to "center".

fps

Frames/slides shown per second. Defaults to 3.

init_rescale_data

When TRUE will apply tourr::rescale() on the data. Defaults to FALSE.

...

Optionally pass additional arguments to the render_type for plotting options.

Value

An animation of a manual tour.

Examples

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

play_manual_tour(data = flea_std, basis = rb, manip_var = 4)

play_manual_tour(data = flea_std, basis = rb, manip_var = 6, 
  render_type = render_gganimate, col = col_of(flea$species), axes = "bottomleft")
# }

Run the code above in your browser using DataLab