myoverse.datatypes.EMGData.plot_grid_layout#
- EMGData.plot_grid_layout(grid_idx=0, show_indices=True, cmap=None, figsize=None, title=None, colorbar=True, grid_color='black', grid_alpha=0.7, text_color='white', text_fontsize=10, text_fontweight='bold', highlight_electrodes=None, highlight_color='red', save_path=None, dpi=150, return_fig=False, ax=None, autoshow=True)[source]#
Plots the 2D layout of a specific electrode grid with enhanced visualization.
- Parameters:
grid_idx (int, optional) – The index of the grid to plot. Default is 0.
show_indices (bool, optional) – Whether to show the electrode indices in the plot. Default is True.
cmap (plt.cm.ScalarMappable | None, optional) – Custom colormap to use for visualization. If None, a default viridis colormap is used.
figsize (tuple[float, float] | None, optional) – Custom figure size as (width, height) in inches. If None, size is calculated based on grid dimensions. Ignored if an existing axes object is provided.
title (str | None, optional) – Custom title for the plot. If None, a default title showing grid dimensions is used.
colorbar (bool, optional) – Whether to show a colorbar. Default is True.
grid_color (str, optional) – Color of the grid lines. Default is “black”.
grid_alpha (float, optional) – Transparency of grid lines (0-1). Default is 0.7.
text_color (str, optional) – Color of the electrode indices text. Default is “white”.
text_fontsize (int, optional) – Font size for electrode indices. Default is 10.
text_fontweight (str, optional) – Font weight for electrode indices. Default is “bold”.
highlight_electrodes (list[int] | None, optional) – List of electrode indices to highlight. Default is None.
highlight_color (str, optional) – Color to use for highlighting electrodes. Default is “red”.
save_path (str | None, optional) – Path to save the figure. If None, figure is not saved. Default is None.
dpi (int, optional) – DPI for saved figure. Default is 150.
return_fig (bool, optional) – Whether to return the figure and axes. Default is False.
ax (plt.Axes | None, optional) – Existing axes object to plot on. If None, a new figure and axes will be created.
autoshow (bool, optional) – Whether to automatically show the figure. Default is True. Set to False when plotting multiple grids on the same figure.
- Returns:
Figure and axes objects if return_fig is True.
- Return type:
tuple[plt.Figure, plt.Axes] | None
- Raises:
ValueError – If grid_layouts is not available or the grid_idx is out of range.