plotCCA: Plot a solution of canonical correlations

plotCCAR Documentation

Plot a solution of canonical correlations

Description

Plot the canonical solution produced by multiUS::cancorPlus. You can display either regression coefficients (canonical weights) or canonical structure correlations for the first show canonical dimensions, with optional color-coding by sign and magnitude.

Usage

plotCCA(
  ccRes,
  xTitle = "X",
  yTitle = "Y",
  inColors = TRUE,
  show = NULL,
  scaleLabelsFactor = 1/2,
  what = "reg",
  nDigits = 2,
  mar = c(1, 2, 1, 1),
  gapLeft = 0,
  customNames = NULL
)

Arguments

ccRes

The output of multiUS::cancorPlus.

xTitle

Title for the first (X) set of variables.

yTitle

Title for the second (Y) set of variables.

inColors

Logical; plot values in color (TRUE, default) or in black and white (FALSE). Positive values map to blue tones, negative to red.

show

Integer; how many canonical dimensions to display. Defaults to length(ccRes$cor).

scaleLabelsFactor

Numeric scaling exponent for the printed coefficients (default 1/2). The label size is proportional to |value|^scaleLabelsFactor.

what

What to plot: regression coefficients "reg" (default) or canonical structure correlations "cor". If correlations are unavailable in ccRes$scores, the function falls back to regression coefficients with a warning.

nDigits

Integer; number of decimal places shown for printed values.

mar

Numeric vector of plot margins; passed to graphics::par. Default is c(1, 2, 1, 1).

gapLeft

Integer; number of empty column gaps to insert before the first canonical dimension (useful for aligning multiple panels). Default 0.

customNames

Optional named character vector for relabeling variables. Names should match rownames(ccRes$xcoef) and/or rownames(ccRes$ycoef); values are the labels to display. Unmatched variables keep their original names (or default to "Var X#"/"Var Y#" when row names are missing).

Value

Draws the plot.

Author(s)

Marjan Cugmas

Examples

tmp<-cancorPlus(x = mtcars[, c(1,2,3)], y = mtcars[, c(4,5, 6)], useCCApackage = TRUE)
plotCCA(tmp, scaleLabelsFactor = 1/2, what = "cor", customNames = c("cyl" = "Cylinders"))

multiUS documentation built on Sept. 18, 2025, 3:01 p.m.

Related to plotCCA in multiUS...