Skip to contents

This function takes a fitted MPCA model (e.g. from mixture_pca_em_fit()) and produces a faceted heatmap or bar plot of each cluster's factor loadings W[[k]] (an M x r matrix).

Usage

plot_cluster_synergy_loadings_mpca(
  mpca_fit,
  cluster_ids = NULL,
  plot_type = c("heatmap", "bar"),
  muscle_names = NULL
)

Arguments

mpca_fit

A fitted MPCA model object containing W, z, etc.

cluster_ids

A numeric vector of cluster IDs to plot. Defaults to all.

plot_type

One of "heatmap" or "bar". Specifies how to visualize.

muscle_names

Optional character vector of muscle names for y-axis labels. If NULL, default channel names will be used.

Value

A ggplot object (which you can print or further modify).

Examples

if (FALSE) { # \dontrun{
  # Suppose we have a best MPCA model in 'best_mpca_model'
  # that has best_mpca_model$W[[k]] for each cluster
  p <- plot_cluster_synergy_loadings_mpca(best_mpca_model, cluster_ids = 1:2)
  print(p)
} # }