ENH: Route evoked.plot() through MNELineFigure#13795
ENH: Route evoked.plot() through MNELineFigure#13795PragnyaKhandelwal wants to merge 5 commits intomne-tools:mainfrom
Conversation
When evoked.plot() creates its own figure (axes=None), now routes through _line_figure() to instantiate MNELineFigure instead of a plain matplotlib figure. This aligns with the 2D plotting figure-class refactor direction discussed in mne-tools#7751. Behavior unchanged for custom axes. Both plot_white() and plot_joint() remain out of scope here. Adds regression test to assert MNELineFigure instantiation for default path. Closes mne-tools#13747
|
Hi @larsoner, @drammock — just wanted to know the preferred direction for this refactor. |
doc/changes/dev/13795.newfeature.rst
Outdated
| @@ -0,0 +1 @@ | |||
| Made ``evoked.plot()`` instantiate ``MNELineFigure`` when it creates its own figure, aligning this path with the ongoing 2D plotting figure-class refactor discussed in :gh:`7751`. | |||
There was a problem hiding this comment.
needs "by :newcontrib:first last" at the end, and can cross-link with
| Made ``evoked.plot()`` instantiate ``MNELineFigure`` when it creates its own figure, aligning this path with the ongoing 2D plotting figure-class refactor discussed in :gh:`7751`. | |
| Made :meth:`evoked.plot() <mne.Evoked.plot>` instantiate ``MNELineFigure`` when it creates its own figure, aligning this path with the ongoing 2D plotting figure-class refactor discussed in :gh:`7751`. |
And new features are really meant for user-facing changes. If this improves the experience for users it's worth saying here why (e.g., improving interactivity, etc.). If it doesn't, then this should probably be a 13795.other.rst since it's an internal refactoring for maintainability
There was a problem hiding this comment.
Thanks, updated this to an internal refactor entry, used the method cross-link format, and added author credit in existing-contributor style.
mne/viz/evoked.py
Outdated
| if isinstance(axes, plt.Axes): | ||
| axes = [axes] | ||
| fig.set_size_inches(6.4, 2 + len(axes)) | ||
| if plot_type == "butterfly" and hasattr(evoked, "get_channel_types"): |
There was a problem hiding this comment.
ahh my bad.... The hasattr guard was unnecessary here..Thanks....
Reference issue (if any)
Closes #13747
Related to #7751
What does this implement/fix?
When evoked.plot() creates its own figure (axes=None), it now routes through _line_figure() to instantiate MNELineFigure instead of a plain Matplotlib figure.
This aligns the default 2D plotting path with the refactor direction discussed in #7751, while keeping behavior unchanged when users pass custom axes.
Scope is intentionally limited:
evoked.plot_white() is out of scope
evoked.plot_joint() is out of scope
A regression test was added to assert MNELineFigure instantiation for the default evoked.plot() path.
Additional information
This is a localized, backward-compatible enhancement intended as an incremental step toward #7751, not a full closure of that broader refactor.