oblique_frame: Plot a single frame of a manual tour

Description Usage Arguments Value Examples

View source: R/oblique_frame.r

Description

Projects the specified rotation as a 2D ggplot object. Analogous to a slide frame of a radial tour. Used to create an oblique tour by small changes to the rotation.

Usage

1
2
3
oblique_frame(data = NULL, basis = NULL, manip_var, theta = 0,
  phi = 0, manip_col = "blue", col = "black", pch = 20,
  axes = "center", rescale_data = FALSE, alpha = 1, ...)

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. Required, no default. If left NULL, will initialize the radial angle of the manip_var.'

phi

Phi is angle in radians of the "out-of-plane" rotation, the z-axis of the reference frame. Required, no default.

manip_col

String of the color to highlight the manip_var. Defaults to "blue".

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

rescale_data

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

alpha

Opacity of the data points between 0 and 1. Defaults to 1.

...

Optionally pass additional arguments to the render_type for plotting options.

Value

a ggplot object of the rotated projection.

Examples

1
2
3
4
5
6
flea_std <- tourr::rescale(tourr::flea[,1:6])
rb <- tourr::basis_random(n = ncol(flea_std))
theta <- runif(1, 0, 2*pi)
phi <- runif(1, 0, 2*pi)

oblique_frame(data = flea_std, basis = rb, manip_var = 4, theta, phi)

nspyrison/spinifex documentation built on Aug. 23, 2019, 1:21 p.m.