50% off: Unlimited data and AI learning.
State of Data and AI Literacy Report 2025

spinifex (version 0.2.5)

oblique_frame: Plot a single frame of a manual tour

Description

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

Usage

oblique_frame(
  basis = NULL,
  data = NULL,
  manip_var = NULL,
  theta = 0L,
  phi = 0L,
  lab = NULL,
  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

Number of the variable 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.

lab

Optionally, provide a character vector of length p (or 1) to label the variable contributions to the axes, Default NULL, results in a 3 character abbreviation of the variable names.

rescale_data

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

...

Optionally pass additional arguments to the render_type for projection point aesthetics; geom_point(aes(...)).

Value

A ggplot object of the rotated projection.

Examples

Run this code
# NOT RUN {
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)

oblique_frame(data = flea_std, basis = rb, manip_var = 4,
              theta = 0, phi = 1,
              lab = paste0("MyNm", 3:8), rescale_data = TRUE)
# }

Run the code above in your browser using DataLab