view_frame: Plot a single frame of a manual tour

Description Usage Arguments Value See Also Examples

View source: R/3_visualize.r

Description

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

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
view_frame(
  basis = NULL,
  data = NULL,
  manip_var = NULL,
  theta = 0L,
  phi = 0L,
  basis_label = abbreviate(row.names(basis), 3L),
  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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## Setup
dat_std <- scale_sd(wine[, 2:6])
clas <- wine$Type
bas <- basis_pca(dat_std)
mv <- manip_var_of(bas)

## Minimal example
## Not run: 
view_frame(basis = bas)

## Typical example
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)
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))
## End(Not run)

spinifex documentation built on Sept. 28, 2021, 5:09 p.m.