myoverse.datatypes.EMGData.plot#
- EMGData.plot(representation, nr_of_grids=None, nr_of_electrodes_per_grid=None, scaling_factor=20.0, use_grid_layouts=True)[source]#
Plots the data for a specific representation.
- Parameters:
representation (str) – The representation to plot.
nr_of_grids (Optional[int], optional) – The number of electrode grids to plot. If None and grid_layouts is provided, will use the number of grids in grid_layouts. Default is None.
nr_of_electrodes_per_grid (Optional[int], optional) – The number of electrodes per grid to plot. If None, will be determined from data shape or grid_layouts if available. Default is None.
scaling_factor (Union[float, List[float]], optional) – The scaling factor for the data. The default is 20.0. If a list is provided, the scaling factor for each grid is used.
use_grid_layouts (bool, optional) – Whether to use the grid_layouts for plotting. Default is True. If False, will use the nr_of_grids and nr_of_electrodes_per_grid parameters.
Examples
>>> import numpy as np >>> from myoverse.datatypes import EMGData, create_grid_layout >>> >>> # Create sample EMG data (64 channels, 1000 samples) >>> emg_data = np.random.randn(64, 1000) >>> >>> # Create EMGData with two 4×8 grids (32 electrodes each) >>> grid1 = create_grid_layout(4, 8, 32, fill_pattern='row') >>> grid2 = create_grid_layout(4, 8, 32, fill_pattern='row') >>> >>> # Adjust indices for second grid >>> grid2[grid2 >= 0] += 32 >>> >>> emg = EMGData(emg_data, 2000, grid_layouts=[grid1, grid2]) >>> >>> # Plot the raw data using the grid layouts >>> emg.plot('Input') >>> >>> # Adjust scaling for better visualization >>> emg.plot('Input', scaling_factor=[15.0, 25.0]) >>> >>> # Plot without using grid layouts (specify manual grid configuration) >>> emg.plot('Input', nr_of_grids=2, nr_of_electrodes_per_grid=32, ... use_grid_layouts=False)