Make blocking consistent#14098
Open
cbrnr wants to merge 2 commits into
Open
Conversation
larsoner
reviewed
Jul 24, 2026
| @@ -0,0 +1 @@ | |||
| The ``block`` parameter of :meth:`mne.time_frequency.Spectrum.plot_topo`, the legacy ``plot_psd_topo`` methods (e.g. :meth:`mne.io.Raw.plot_psd_topo`), and :func:`mne.viz.plot_raw_psd_topo` is deprecated and will be removed in MNE 1.15; these plots now follow Matplotlib's blocking behavior, by `Clemens Brunner`_. | |||
Member
There was a problem hiding this comment.
CircleCI doesn't like that link
/home/circleci/project/doc/<rst_prologue>:75: WARNING: py:func reference target not found: mne.viz.plot_raw_psd_topo [ref.func]
drammock
reviewed
Jul 24, 2026
| %(axis_facecolor)s | ||
| %(axes_spectrum_plot_topo)s | ||
| %(block)s | ||
| block : bool |
Member
There was a problem hiding this comment.
Suggested change
| block : bool | |
| block : bool | None |
| Show the figure if ``True``. When shown, blocking follows | ||
| :func:`matplotlib.pyplot.show`: the call blocks until the window is closed unless | ||
| Matplotlib's interactive mode is on (enabled with :func:`matplotlib.pyplot.ion`, | ||
| which IPython's Matplotlib integration turns on automatically), in which case it |
Member
There was a problem hiding this comment.
I think this line is misleading/ambiguous; it could be interpreted to mean that IPython automatically enables plt.ion (but it only does that if you use the %matplotlib magic)
| @@ -588,8 +588,8 @@ def plot_raw_psd_topo( | |||
| Defaults to black. | |||
| %(axes_spectrum_plot_topo)s | |||
| block : bool | |||
Member
There was a problem hiding this comment.
Suggested change
| block : bool | |
| block : bool | None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #13955.
Here's what I changed to make the blocking behavior consistent:
plot_evoked_topomap: removed hardcodedblock=False(so this is now consistent with other plotting functions).plot_sensors(plus corresponding methods): changedblock=Falsetoblock=None(here the argument is useful to force blocking when needed forkind="select").Spectrum.plot_topo,plot_psd_topomethods,plot_raw_psd_topo: deprecated theblockargument since I don't think these functions need it.So the behavior now is as follows: Since
show=Trueby default, this essentially means that the functions callplt.show()internally. This shows the figure and blocks by default. Blocking can be changed via%matplotlibin IPython orplt.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).