Skip to content

Fix: Handle inline backends in plt_show#14076

Open
mh105 wants to merge 2 commits into
mne-tools:mainfrom
mh105:agent/upstream-inline-plt-show
Open

Fix: Handle inline backends in plt_show#14076
mh105 wants to merge 2 commits into
mne-tools:mainfrom
mh105:agent/upstream-inline-plt-show

Conversation

@mh105

@mh105 mh105 commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Reference issue (if any)

None

What does this implement/fix?

mne.viz.utils.plt_show() currently calls Figure.show() when it receives a figure. With a Matplotlib inline backend, that call does not reliably trigger display in notebook-style frontends. This includes the VS Code Interactive Window that some people use. matplotlib.pyplot.show() does.

This change detects inline backend identifiers case-insensitively and routes them through plt.show(**kwargs). Other GUI backends continue to use (fig or plt).show(**kwargs), while the existing no-show behavior for Agg and show=False remains unchanged.

Additional information

I manually identified the issue and implemented the fix, but Codex added the test case to mne/viz/tests/test_utils.py

@mh105
mh105 requested a review from drammock as a code owner July 19, 2026 18:33
@mh105 mh105 changed the title FIX: Handle inline backends in plt_show Fix: Handle inline backends in plt_show Jul 19, 2026
Comment thread mne/viz/utils.py
Add comment regarding fig.show() failure for inline backends.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants