Fix: Handle inline backends in plt_show#14076
Conversation
Add comment regarding fig.show() failure for inline backends.
|
I'm okay with this at the MNE-Python end, but it does seem like a workaround... is there an upstream issue? Would be good to let them know this is an issue if they don't In the meantime CIs have failed due to style (line too long), can you fix it? |
Updated comment for clarity regarding inline backend behavior.
|
@larsoner I actually think this is an appropriate MNE-Python fix:
I think the main issue here is that we always call But For this reason, I didn't want to add a condition to |
|
I edited the comment line as well. The still failing CI seems to be out of my control... |
|
Could you register for an Circle-CI account so that the documentation CI can run? |
|
Thanks @mh105 ! |
Reference issue (if any)
None
What does this implement/fix?
mne.viz.utils.plt_show()currently callsFigure.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 andshow=Falseremains 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