Skip to content

Make blocking consistent#14098

Open
cbrnr wants to merge 3 commits into
mne-tools:mainfrom
cbrnr:mpl-block
Open

Make blocking consistent#14098
cbrnr wants to merge 3 commits into
mne-tools:mainfrom
cbrnr:mpl-block

Conversation

@cbrnr

@cbrnr cbrnr commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Fixes #13955.

Here's what I changed to make the blocking behavior consistent:

  • plot_evoked_topomap: removed hardcoded block=False (so this is now consistent with other plotting functions).
  • plot_sensors (plus corresponding methods): changed block=False to block=None (here the argument is useful to force blocking when needed for kind="select").
  • Spectrum.plot_topo, plot_psd_topo methods, plot_raw_psd_topo: deprecated the block argument since I don't think these functions need it.

So the behavior now is as follows: Since show=True by default, this essentially means that the functions call plt.show() internally. This shows the figure and blocks by default. Blocking can be changed via %matplotlib in IPython or plt.ion() in the regular Python REPL. I'm not sure about Jupyter notebooks, but I think whatever they do shouldn't have changed (they probably do not block by default).

@cbrnr
cbrnr requested review from agramfort and larsoner as code owners July 24, 2026 10:27
@cbrnr
cbrnr requested a review from wmvanvliet July 24, 2026 10:28

@larsoner larsoner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay for me, @drammock did you want to look?

Comment thread doc/changes/dev/14098.apichange.rst Outdated
Comment thread mne/time_frequency/spectrum.py Outdated
Comment thread mne/utils/docs.py Outdated
Comment thread mne/viz/raw.py Outdated
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.

[DISCUSSION] Showing figures when running in non-interactive python: to block or not to block?

3 participants