Skip to contents

This function plots the reconstructed waveforms (Xhat_i) for each subject across all channels, grouped by cluster. By default, it overlays all subjects in the same cluster, then uses facet to separate by (Cluster, Channel).

Usage

plot_all_reconstructed_waveforms_mfa(
  mfa_fit,
  list_of_data,
  overlay_subjects = TRUE,
  muscle_names = NULL
)

Arguments

mfa_fit

A fitted MFA model (with z, Lambda, Psi, mu, etc.).

list_of_data

A list of (T_i x M) data matrices used in fitting.

overlay_subjects

Logical; if TRUE, each subject in the same cluster is drawn in the same facet. If FALSE, the function computes the average waveforms across subjects in each cluster.

muscle_names

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

Value

A ggplot object with line plots of reconstructed waveforms, facet by cluster & channel.

Examples

if (FALSE) { # \dontrun{
  p_recon <- plot_all_reconstructed_waveforms_mfa(mfa_fit, list_of_data)
  print(p_recon)
} # }