Skip to contents

Visualizes EMG time-series per cluster and subject. When cluster_id is NULL, shows all clusters. For each cluster, individual subject EMG traces are shown as thin semi-transparent lines, with the cluster-mean waveform overlaid as a bold black line.

Usage

plot_reconstructed_emg(
  sim,
  cluster_id = NULL,
  muscles = NULL,
  mean_ci = FALSE,
  theme_base_size = 13
)

Arguments

sim

A list returned by simulate_dynamic_synergy_data(). Must contain X_list and z_true components.

cluster_id

Integer specifying which cluster to plot. If NULL, plots all clusters. Default is NULL.

muscles

Integer vector specifying which muscles to plot. If NULL, plots all muscles. Default is NULL.

mean_ci

Logical; if TRUE, display +/-1 SD ribbons (not yet implemented). Default is FALSE.

theme_base_size

Base font size for the plot theme. Default is 13.

Value

A ggplot object showing EMG time-series with individual subjects and cluster means.

Examples

if (FALSE) { # \dontrun{
sim <- simulate_dynamic_synergy_data(N=30, K=3, r=3, M=8, T_each=200)
plot_reconstructed_emg(sim)
plot_reconstructed_emg(sim, cluster_id = 1)
plot_reconstructed_emg(sim, muscles = c(1, 2, 3))
} # }