[Superseded], see ggtour. Projects the specified rotation as a 2D ggplot object. One static frame of manual tour. Useful for providing user-guided interaction.

view_frame(
  basis = NULL,
  data = NULL,
  manip_var = NULL,
  theta = 0,
  phi = 0,
  basis_label = abbreviate(row.names(basis), 3),
  rescale_data = FALSE,
  ...
)

Arguments

basis

A (p, d) dim orthonormal numeric matrix. Defaults to NULL, giving a random basis.

data

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

manip_var

Optional, number of the variable to rotate. If NULL, theta and phi must be 0 as is no manip space to rotate.

theta

Angle in radians of "in-projection plane" rotation, on the xy plane of the reference frame. Defaults to 0, no rotation.

phi

Angle in radians of the "out-of-projection plane" rotation, into the z-direction of the axes. Defaults to 0, no rotation.

basis_label

Optional, character vector of p length, add name to the axes in the frame, defaults to 3 letter abbreviation of the original variable names.

rescale_data

When TRUE scales the data to between 0 and 1. Defaults to FALSE.

...

Optionally pass additional arguments to the proto_default for projection point aesthetics;

Value

A ggplot object of the rotated projection.

See also

proto_default For arguments to pass into ....

Examples

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

## Setup
dat_std <- scale_sd(wine[, 2:6])
clas    <- wine$Type
bas     <- basis_pca(dat_std)
mv      <- manip_var_of(bas)

## Minimal example
# \donttest{
suppressWarnings(
  view_frame(basis = bas)
)


## Typical example
suppressWarnings(
  view_frame(basis = bas, data = dat_std, manip_var = mv, axes = "left")
)


## Full example
rtheta <- runif(1, 0, 2 * pi)
rphi   <- runif(1, 0, 2 * pi)
suppressWarnings(
  view_frame(
    basis = bas, data = dat_std, manip_var = mv,
    theta = rtheta, phi = rphi, basis_label = paste0("MyNm", 1:ncol(dat_std)), 
    aes_args = list(color = clas, shape = clas),
    identity_args = list(size = 1.5, alpha = .7))
)

# }