mne_denoise.viz.plot_forest#

mne_denoise.viz.plot_forest(data, metric_col, ci_col=None, se_col=None, group_col='group', subject_col='subject', target_group=None, baseline_group=None, group_colors=None, group_labels=None, metric_label=None, reference_line=0.0, suptitle=None, figsize=None, fname=None, show=True)[source]#

Plot per-subject point estimates with confidence intervals.

Parameters:
  • data (mapping of str to array-like) – Columnar mapping with group, subject, and metric columns.

  • metric_col (str) – Metric column to display on the x-axis.

  • ci_col (str | None) – Optional half-width CI column for each subject estimate.

  • se_col (str | None) – Optional SE column. If provided and ci_col is absent, CI is approximated as 1.96 * SE.

  • group_col (str) – Grouping column name.

  • subject_col (str) – Subject identifier column name.

  • target_group (str | None) – Group to plot as primary forest series. Defaults to the last first-seen group.

  • baseline_group (str | None) – Optional baseline group to overlay with faint points and mean marker.

  • group_colors (dict | None) – Optional style overrides keyed by group.

  • group_labels (dict | None) – Optional style overrides keyed by group.

  • metric_label (str | None) – X-axis label. If None, derived from metric_col.

  • reference_line (float | None) – Optional vertical reference line value.

  • suptitle (str | None) – Figure title override.

  • figsize (tuple | None) – Figure size in inches.

  • 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_forest
>>> data = {
...     "subject": np.array(["s1", "s2", "s1", "s2"]),
...     "group": np.array(["A", "A", "B", "B"]),
...     "effect": np.array([0.2, 0.4, 0.8, 0.9]),
... }
>>> fig = plot_forest(data, metric_col="effect", group_col="group", show=False)