backend parameter of viz._3d.plot_source_estimates needs some love
See original GitHub issueDescribe the bug
Passing backend='pyvista' to plot_source_estimates() currently is not supported, although we do support PyVista:
https://github.com/mne-tools/mne-python/blob/6f16c3771d79dda19b5ff0a058396f468a3e57f6/mne/viz/_3d.py#L1750
Also, the backend parameter is not used for anything except for checking whether we should use Matplotlib or not; if backend != 'matplotlib', we simply use _get_3d_backend() to retrieve the backend to use. This means that e.g.if you have PyVista installed, passing backend='mayavi' will still use the pyvista backend.
Expected results
backendshould be allowed to be'pyvista'as well- the value of
backendshould be honored
Additional information
Also wondering if the backend param should be deprecated or changed. Maybe it could only support matplotlib and 3d or so, and 3d would select the default 3D backend?
Or we deprecate it and if we cannot detect a valid 3D backend, we fall back to Matplotlib. (We already kind of do that, if I’m reading the code correctly)
Issue Analytics
- State:
- Created 3 years ago
- Comments:16 (16 by maintainers)

Top Related StackOverflow Question
I don’t think the
matplotlibbackend can ever be anywhere near feature-complete compared to Brain – matplotlib isn’t really designed to do 3D plotting on this scale. We can keep hacking together bits (foci for example are probably easy as scatter3d) but ultimately it’s not going to provide a very satisfying or usable (let alone visually appealing) experience. To me it’s what you use if you need something very basic and can’t use Brain.To me it’s probably worth putting effort into figuring out how to get CPU-based rendering using Mesa OpenGL software rendering on any system whose OpenGL isn’t good enough to render 3D properly. Then we can rely on VTK + Brain to do everything. And if this works hopefully we can just kill the matplotlib backend someday. I’ve hacked together solutions like this on other systems so in principle I think it’s possible. I’ve also seen some conda-forge stuff involving osmesa but I don’t know the details – if we could tell people they could install an osmesa variant of VTK rather than the standard one, that might automagically make Brain work for people.
It’s not broken it’s partial. I pushed for this to have a solution for master students while teaching and as a fall back when mayavi was really impossible to install / use. Serious work publication oriented cannot be done with matplotlib backend