show_ridge_pca {ridgetorus} | R Documentation |
Illustration of toroidal PCA via density ridges
Description
Shows the scores computation for PCA via density ridges on
[-\pi, \pi)^2
.
Usage
show_ridge_pca(
fit,
n_max = 500,
projs = TRUE,
projs_lines = TRUE,
signs = TRUE,
col_data = 1,
col_projs = c(3, 4),
main = "",
N = 500,
at2 = TRUE
)
Arguments
fit |
the output of |
n_max |
maximum number of data points to draw. These are sampled from
the data provided. Defaults to |
projs |
draw projections? Defaults to |
projs_lines |
draw projection lines? Defaults to |
signs |
plot the original data points with |
col_data |
color(s) for the data points. Defaults to |
col_projs |
a vector of size |
main |
caption of the plot. Empty by default. |
N |
number of discretization points for approximating curve lengths.
Defaults to |
at2 |
do the |
Value
Nothing, the functions are called to produce plots.
Examples
# Generate data
set.seed(987654321)
n <- 50
S1 <- rbind(c(1, -0.7), c(-0.7, 1))
S2 <- rbind(c(1, 0.5), c(0.5, 1))
x <- rbind(mvtnorm::rmvnorm(n, mean = c(0, pi / 2), sigma = S1),
mvtnorm::rmvnorm(n, mean = c(pi, -pi / 2), sigma = S2))
x <- sdetorus::toPiInt(x)
col <- rainbow(2)[rep(1:2, each = n)]
# ridge_pca and its visualization
fit <- ridge_pca(x = x, at2 = FALSE)
show_ridge_pca(fit = fit, col_data = col, at2 = FALSE)
fit2 <- ridge_pca(x = x, at2 = TRUE)
show_ridge_pca(fit = fit2, col_data = col, at2 = TRUE)