View source: R/1_manual_tour.r
manual_tour | R Documentation |
Typically called by array2af()
. An array of projections,
the radial tour of the manip_var
, which is rotated from phi's starting
position to phi_max
, to phi_min
, and back to the start position.
manual_tour(
basis,
manip_var,
theta = NULL,
phi_min = 0,
phi_max = pi/2,
data = NULL
)
basis |
A (p, d) orthonormal numeric matrix. The linear combination the original variables contribute to projection space. Defaults to NULL, generating a random basis. |
manip_var |
Integer column number or string exact column name of the. variable to manipulate. Required, no default. |
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. |
data |
Optionally attach data to the basis path. |
A (p, d, 4) history_array of the radial tour. The bases set for
phi_start, phi_min
, phi_max
, and back to phi_start.
Other manual tour adjacent functions:
create_manip_space()
,
interpolate_manual_tour()
,
manip_var_of()
,
rotate_manip_space()
library(spinifex)
dat <- scale_sd(wine[, 2:6])
clas <- wine$Type
bas <- basis_pca(dat)
mv <- manip_var_of(bas)
manual_tour(basis = bas, manip_var = mv)
## All arguments
manual_tour(basis = bas, manip_var = mv,
theta = pi / 2, phi_min = pi / 16, phi_max = pi)
## Animating with ggtour() & proto_* (d = 2 case)
mt <- manual_tour(basis = bas, manip_var = mv)
ggt <- ggtour(mt, dat, angle = .2) +
proto_origin() +
proto_point(list(color = clas, shape = clas)) +
proto_basis()
animate_plotly(ggt)
## d = 1 case
## basis could be 1- or 2D; protos_* only use 1st column
mv <- manip_var_of(bas)
mt <- manual_tour(basis = bas, manip_var = mv)
ggt <- ggtour(mt, dat, angle = .3) +
proto_density(aes_args = list(color = clas, fill = clas)) +
proto_basis1d() +
proto_origin1d()
animate_plotly(ggt)
## Bring your own basis
bas <- matrix(rnorm(2 * ncol(dat)), ncol = 2)
bas <- orthonormalise(bas) ## manual_tour warns if basis isn't orthonormal
mt <- manual_tour(basis = bas, manip_var = 1)
ggt <- ggtour(mt, dat, angle = .2) +
proto_default(aes_args = list(color = clas, shape = clas))
animate_plotly(ggt)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.