pyCGM2.Lib.plot.compareEmgEnvelops#

pyCGM2.Lib.plot.compareEmgEnvelops(DATA_PATH: str, analyses: List[Analysis], legends: List[str], normalized: bool = False, plotType='Descriptive', show: bool = True, title: str | None = None, eventType: str = 'Gait', OUT_PATH: str | None = None, outputName: str | None = None, exportPng: bool = False, exportPdf: bool = False, autoYlim: bool = False, **kwargs)#

Plots EMG envelopes from different analysis instances for comparison.

This function visualizes and compares EMG data from multiple analysis instances. It supports descriptive and consistency plot types and allows the comparison of EMG envelopes, with options for normalization and event type specification.

Parameters:
  • DATA_PATH (str) – Path to the data directory.

  • analyses (List[Analysis]) – List of Analysis instances to compare.

  • legends (List[str]) – Labels representing each analysis instance.

  • normalized (bool) – If True, displays normalized EMG amplitude. Defaults to False.

  • plotType (str) – Type of plot (‘Descriptive’ or ‘Consistency’). Defaults to ‘Descriptive’.

  • eventType (str) – Event type to consider (e.g., ‘Gait’). Defaults to ‘Gait’.

  • show (bool) – If True, shows the plot using Matplotlib. Defaults to True.

  • title (Optional[str]) – Title for the plot panel. Defaults to None.

  • OUT_PATH (Optional[str]) – Path for saving exported files. Defaults to None.

  • outputName (Optional[str]) – Name of the output file. Defaults to None.

  • exportPng (bool) – If True, exports the plot as a PNG. Defaults to False.

  • exportPdf (bool) – If True, exports the plot as a PDF. Defaults to False.

  • autoYlim (bool) – If True, sets Y-axis limits automatically. Defaults to False.

Keyword Arguments:

forceEmgManager (Optional[pyCGM2.EMG.EmgManager]) – Use a specific EmgManager instance.

Returns:
  • Union[matplotlib.figure.Figure, Tuple[matplotlib.figure.Figure, str]] – The Matplotlib figure object.

  • If exporting as PNG, returns a tuple of the figure object and the filename.

Examples

>>> fig = compareEmgEnvelops("/data/path", [analysis1, analysis2], ["pre", "post"])

Note

The function is particularly useful for comparing EMG patterns across different conditions or time points, providing insights into muscle activation consistency or variability.