plot_correlation: Task Correlation Map for orthoMTL

View source: R/plot.R

plot_correlationR Documentation

Task Correlation Map for orthoMTL

Description

Displays pairwise distances between task coefficient vectors as a heatmap. Distance is computed as 1 - cosine_similarity. Values near 0 indicate similar coefficient profiles; values near 1 indicate orthogonal profiles.

Usage

plot_correlation(x, midpoint = 0.5, limits = c(0, 1))

Arguments

x

Either a fitted "orthoMTL" object or a numeric coefficient matrix with dimensions p x numTasks.

midpoint

Midpoint for the colour scale. Default: 0.5.

limits

Numeric vector of length 2 for the colour scale limits. Default: c(0, 1).

Value

A ggplot2 object.

See Also

plot_heatmap

Examples

set.seed(42)
n <- 100; p <- 10; n_tasks <- 4
X <- matrix(rnorm(n * p), n, p)
colnames(X) <- paste0("V", seq_len(p))
Y <- X %*% matrix(rnorm(p * n_tasks), p) + matrix(rnorm(n * n_tasks), n) * 0.1
colnames(Y) <- c("T1", "T2", "T3", "T4")
K <- matrix(1, n_tasks, n_tasks); diag(K) <- 0.5
fit <- orthoMTL(X, Y, lambda = 1e-3, K = K)

plot_correlation(fit)

orthoMTL documentation built on Aug. 23, 2026, 5:10 p.m.