mne_denoise.viz.plot_metric_bars#

mne_denoise.viz.plot_metric_bars(data, metric_cols, metric_labels=None, lower_better=None, group_col='group', group_order=None, group_colors=None, group_labels=None, title='Metric Comparison (group mean ± SEM)', fname=None, show=True)[source]#

Plot grouped bar charts for one or more scalar metrics.

Parameters:
  • data (mapping of str to array-like) – Columnar data mapping. All columns must be 1D and have equal length.

  • metric_cols (list of str) – Metric columns to visualize.

  • metric_labels (list of str | None) – Axis labels corresponding to metric_cols. If None, labels are derived from metric names.

  • lower_better (list of bool | None) – Whether smaller values indicate better performance for each metric. If None, no best-marker star is added.

  • group_col (str) – Column name identifying comparison groups.

  • group_order (list of str | None) – Explicit order for group bars. If None, first-seen order is used.

  • group_colors (dict | None) – Optional color/label overrides keyed by group name.

  • group_labels (dict | None) – Optional color/label overrides keyed by group name.

  • title (str) – Figure-level title.

  • fname (path-like | None) – Optional output path.

  • show (bool) – Whether to display the figure.

Returns:

fig – Figure handle.

Return type:

matplotlib.figure.Figure

Examples

>>> import numpy as np
>>> from mne_denoise.viz import plot_metric_bars
>>> data = {
...     "group": np.array(["A", "A", "B", "B"]),
...     "score": np.array([0.9, 1.0, 0.7, 0.8]),
... }
>>> fig = plot_metric_bars(
...     data, metric_cols=["score"], group_col="group", show=False
... )