Dear @richard, thank you!
I am using PyCharm environment.
mne.sys_info() gives:
Platform: macOS-10.15.7-x86_64-i386-64bit
Python: 3.10.2 (v3.10.2:a58ebcc701, Jan 13 2022, 14:50:16) [Clang 13.0.0 (clang-1300.0.29.30)]
Executable: /Users/anaelle/PycharmProjects/main/venv/bin/python
CPU: i386: 4 cores
Memory: Unavailable (requires "psutil" package)
mne: 1.1.0
numpy: 1.23.1 {}
scipy: 1.9.0
matplotlib: 3.5.2 {backend=MacOSX}
sklearn: 1.1.1
numba: Not found
nibabel: 4.0.1
nilearn: 0.9.1
dipy: Not found
cupy: Not found
pandas: 1.4.3
pyvista: 0.36.1 {OpenGL 4.1 NVIDIA-14.0.32 355.11.11.10.10.143 via NVIDIA GeForce GT 755M OpenGL Engine}
pyvistaqt: 0.9.0
ipyvtklink: Not found
vtk: 9.2.0.rc2
qtpy: 2.1.0 {PyQt5=5.15.2}
ipympl: Not found
pyqtgraph: Not found
pooch: v1.6.0
mne_bids: Not found
mne_nirs: Not found
mne_features: Not found
mne_qt_browser: Not found
mne_connectivity: 0.3
mne_icalabel: 0.2
Can you try to run the script from the command line, outside of PyCharm, to see if this changes anything?
Getting MNE and all dependencies installed manually in a way that actually works well can be notoriously difficult. We therefore suggest you closely follow our installation instructions, which ask you to create a conda environment; or you could even try out our standalone installer if you want.
Dear @richard, running the script in the terminal directly in Python has worked perfectly.
Also running it in the terminal through PyCharm works fine.
Looks like only the Python Console from PyCharm gives rise to this issue.
So after testing a few things up, like changing backends in source files, using several functions for plotting and visualisation, it turned out adding matplotlib.use('Qt5Agg') solved the problem !
While I thought it was using default Qt5Agg backend, apparently it was not and forcing it did the thing.