Learn R Programming

spinifex (version 0.2.5)

view_basis: Plot the axes directions of the basis table without data points.

Description

ggplot2 object of axes contribution inscribed in a unit circle.

Usage

view_basis(basis, data = NULL, lab = NULL, axes = "center", ...)

Arguments

basis

A (p, d) orthonormal numeric matrix. The linear combination the original variables contribute to projection space. Required, no default.

data

Optional (n, p) data to plot on through the projection basis.

lab

Optional, labels for the reference frame of length 1 or the number of variables used. By default will abbreviate data if available.

axes

Position of the axes: "center", "bottomleft" or "off". Defaults to "center".

...

Optionally passes arguments to the projection points inside the aesthetics; geom_point(aes(...)).

Value

ggplot object of the basis.

Examples

Run this code
# NOT RUN {
rb <- tourr::basis_random(4, 2)
view_basis(basis = rb)

flea_std <- tourr::rescale(tourr::flea[, 1:4])
view_basis(basis = rb, data = flea_std, axes = "bottomleft")

view_basis(basis = rb, data = flea_std, axes = "right", 
           col = col_of(tourr::flea[, 7], "Paired"), 
           pch = pch_of(tourr::flea[,7]),
           alpha = .7, size = 2)
# }

Run the code above in your browser using DataLab