3d plotting - empty plot


I experience problems with 3d plotting. I used to use mayavi, but since it has been discontinued only matplotlib works for me (which looks a bit ugly). pyvistaqt 3d backend returns an empty plot.

I installed modules by “curl --remote-name https://raw.githubusercontent.com/mne-tools/mne-python/main/environment.yml” and later using pip install.

MNE version 1.1.1
NAME=“Debian GNU/Linux”
VERSION=“11 (bullseye)”

I am trying to plot source estimate with a simple line stc.plot(subject). The subject is ‘fsaverage’.
The output looks like that (below). When I press play, nothing is showing on the top plot, but the bottom plot is changing.

Thank you in advance!

  1. can you try with the MNE-Python sample data, and see if the brain shows up in that case?

  2. if that doesn’t work, please share the result of mne.sys_info()

  3. If it does work with sample data but not with your data, please share a complete code sample, so we can hopefully see what might be going wrong. (It’s hard to tell if all we know is “I tried stc.plot('fsaverage') and it didn’t work”.) If possible include a link to the data file (if it’s huge, a cropped version of just 1-2 seconds is fine), so we can try to fully reproduce.

1 Like

Dear Dan,

Thank you for your suggestions! I apologize for the insufficient description.
I downloaded sample data and followed this tutorial for plotting Plotting with mne.viz.Brain — MNE 1.2.dev0 documentation. Unfortunately, the result is the same.

The output

Platform:         Linux-5.10.0-17-amd64-x86_64-with-glibc2.31
Python:           3.9.2 (default, Feb 28 2021, 17:03:44)  [GCC 10.2.1 20210110]
Executable:       /data/u_studenova_software/PycharmProjects/source-space-connectivity-optimization/venv/bin/python
CPU:              : 24 cores
Memory:           250.9 GB
mne:              1.1.1
numpy:            1.23.3 {}
scipy:            1.9.1
matplotlib:       3.6.0Backend QtAgg is interactive backend. Turning interactive mode on.
sklearn:          1.1.2
numba:            0.56.2
nibabel:          4.0.2
nilearn:          0.9.2
dipy:             1.5.0
cupy:             Not found
pandas:           1.5.0
pyvista:          0.36.1 {OpenGL 4.5 (Core Profile) Mesa 20.3.5 via llvmpipe (LLVM 11.0.1, 256 bits)}
pyvistaqt:        0.9.0
ipyvtklink:       Matplotlib support failed
Traceback (most recent call last):
  File "/afs/cbs.mpg.de/software/pycharm/2022.2/debian-bullseye-amd64/plugins/python-ce/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 25, in do_import
    succeeded = activate_func()
  File "/afs/cbs.mpg.de/software/pycharm/2022.2/debian-bullseye-amd64/plugins/python-ce/helpers/pydev/pydev_ipython/matplotlibtools.py", line 155, in activate_pylab
    pylab = sys.modules['pylab']
KeyError: 'pylab'
vtk:              9.1.0
qtpy:             2.2.0 {PyQt5=5.15.2}
ipympl:           0.9.2
pyqtgraph:        0.13.1
pooch:            v1.6.0
mne_bids:         Not found
mne_nirs:         Not found
mne_features:     Not found
mne_qt_browser:   0.4.0
mne_connectivity: Not found
mne_icalabel:     Not found

Before starting, I made a fresh environment with pip-installed-modules from environment.yml file. Shall I now install “not found” and pylab?

Hello @astudenova, please follow our official installation instructions (using conda or our standalone installers, not pip) to ensure you end up with a working installation. It’s tricky getting everything working right “by hand” and with pip alone.

Best wishes,

Edit I just now realized you’re relying on Notebook support for 3D rendering. I don’t think we have a similarly straightforward procedure as for the “non-Notebook” setup :frowning: Sorry.

I’ve never seen this error occurring as part of mne.sys_info(). @larsoner any notion of what might be going on there?

In the latest traceback, it looks like this is a bug with pylab rather than MNE.

For the missing brains, did you try the fixes outlined here for the MESA renderer?


I think in 1.2 we try to autodetect MESA and do the equivalent of mne.viz.set_3d_options(multi_samples=1), which will hopefully fix the issue here!

1 Like

Good day!

Thank you very much for suggestions!
I went through conda installations, but it did not solve the problem.
But mne.viz.set_3d_options(antialias=False) did! mne.sys_info() runs without errors, and I got my brain back! Thank you!

1 Like