Hi,
I am having a hard time adding a figure from ica.plot_properties() into a mne.report, here is the error :
AttributeError Traceback (most recent call last)
<ipython-input-20-90570c3b403e> in <module>
54 with mne.open_report(f_report) as rep:
55 rep = mne.Report(image_format = 'svg', title = subject)
---> 56 rep.add_figs_to_section(figs = ica_figs, captions = ica_captions, section = 'ICA plotting')
57 rep.save(f_report, open_browser = True, overwrite = True)
58 rep.save(f_report[:-2]+'html',open_browser = True, overwrite = True)
~/.virtualenvs/py3.6/lib/python3.6/site-packages/mne/report.py in add_figs_to_section(self, figs, captions, section, scale, image_format, comments, replace)
1110 img_klass = self._sectionvars[section]
1111
-> 1112 img = _fig_to_img(fig, image_format, scale)
1113 html = image_template.substitute(img=img, id=global_id,
1114 div_klass=div_klass,
~/.virtualenvs/py3.6/lib/python3.6/site-packages/mne/report.py in _fig_to_img(fig, image_format, scale, **kwargs)
72 elif not isinstance(fig, Figure):
73 from .viz.backends.renderer import backend, MNE_3D_BACKEND_TESTING
---> 74 backend._check_3d_figure(figure=fig)
75 if not MNE_3D_BACKEND_TESTING:
76 img = backend._take_3d_screenshot(figure=fig)
AttributeError: 'NoneType' object has no attribute '_check_3d_figure'
Here is the code to reproduce the error as well as the raw data used (>100Mo), you can directly see the outputs and the error in the Jupyter Notebook version : reportError_code.zip - Google Drive
It seems to me that the report function can’t display a figure with multiple axes like ica.plot_properties(), if I just add an ica.plot_scores or plot_components figure with only 1 axe in the report it works fine (example also included in the provided code). Also displaying the figure directly outside of the report works fine.
I can’t figure it out why it displays an error related to a 3D figure but trying to solve this with mne.viz.set_3d_backend(“notebook”), and replacing notebook by pyvista or mayavi but none worked…
Setting matplotlib to qt instead of inline as recommended for Linux users won’t work…
I also tried updating to the last mne, matplotlib and Ipython version, didn’t work neither…
I am running out of ideas and it seems nobody ever encountered the same problem so if you have any clue I would appreciate !
Cheers,
Arnaud
Config :
Platform: Linux-4.15.0-141-generic-x86_64-with-Ubuntu-18.04-bionic
Python: 3.6.7 (default, Oct 22 2018, 11:32:17) [GCC 8.2.0]
Executable: /home/arnaud/.virtualenvs/py3.6/bin/python
CPU: x86_64: 4 cores
Memory: Unavailable (requires “psutil” package)
mne: 0.22.1
numpy: 1.16.2 {blas=openblas, lapack=openblas}
scipy: 1.5.2
matplotlib: 3.3.4 {backend=Qt5Agg}
sklearn: 0.23.2
numba: Not found
nibabel: Not found
nilearn: Not found
dipy: Not found
cupy: Not found
pandas: 0.24.2
mayavi: 4.7.2
pyvista: 0.29.1 {OpenGL 4.6 (Core Profile) Mesa 20.0.8 via Mesa DRI Intel(R) HD Graphics 620 (KBL GT2)}
vtk: 9.0.1
PyQt5: 5.12.1