I have a script that I run in terminal using python -i test_epoch_plot.py that implements the function epoch.plot(). The interactive plot appears, but any time I interact with it, I have to return to terminal, hit Enter in order for any clicks or button presses in the plot to take effect, even resizing the window by dragging the edges.
Has anyone else had this issue and know how to make it interactive in real-time?
For some reason, I have to call epochs.plot() twice though before the figure appears. In IPython, this can be solved by %matplotlib at the very beginning.
@marsipu@larsoner Any idea? I think this involves bits of code that were fairly recently touched when we switched to mne-qt-browser as the primary backend.
It could be a bug in MNE-Python, I have a hunch that we’re trying to do too much magic here. On my Mac, I do need to call epochs.plot() twice even when setting block=True. Calling matplotlib.pyplot.ion() also doesn’t help.
This part confuses me; I’ve never seen the inline backend used outside of a notebook. Also I know almost nothing about macOS-specific problems (MPL or otherwise) since I don’t have regular access to a mac. I will say that I’ve recently dug into the backend-abstraction-layer code for raw/epochs/ICA plots, and I find it challenging to keep track of what’s going on; I’ve started a little clean-up in Fix orphaned annot window by drammock · Pull Request #10776 · mne-tools/mne-python · GitHub but there’s certainly room for improvement.
I suspect because of the OS that the MacOSX backend was being used in the original post, and it’s usually not very good/responsive. I’d expect that using Qt would fix the problem because of how they use inputhook/idle processing, and it seems like it indeed worked. So to me this is likely another instance of “tell people to use some variant of Qt rather than the MacOSX matplotlib backend”