Plot surface error: It is not currently possible to manually set the aspect on 3D axes

Hi,
I have an Ubuntu 18.04, with nilearn installed using conda env.
I try to run this example code and keep getting this error:

Traceback (most recent call last):

File “”, line 3, in
threshold=1., bg_map=fsaverage.sulc_right)

File “/home/or/miniconda3/envs/neuroAnalysis/lib/python3.7/site-packages/nilearn/plotting/surf_plotting.py”, line 419, in plot_surf_stat_map
cbar_vmin=cbar_vmin, cbar_vmax=cbar_vmax, **kwargs)

File “/home/or/miniconda3/envs/neuroAnalysis/lib/python3.7/site-packages/nilearn/plotting/surf_plotting.py”, line 190, in plot_surf
axes.set_aspect(.74)

File “/home/or/miniconda3/envs/neuroAnalysis/lib/python3.7/site-packages/matplotlib/axes/_base.py”, line 1281, in set_aspect
'It is not currently possible to manually set the aspect ’

NotImplementedError: It is not currently possible to manually set the aspect on 3D axes

I’m Using matplotlib backend: Qt5Agg (in case its relevant).

Any idea what’s wrong?

BTW - when I use Jupyter to run the browser surface, it shows on the browser with no issues.

yes, it is due to a breaking change in matplotlib 3.1
the problem has been fixed on nilearn master; see

https://github.com/nilearn/nilearn/pull/2070
https://github.com/nistats/nistats/issues/358

but I don’t think this has been released yet; the bugfix will be available after
the next nilearn release.

so you can either install nilearn from the source repo, or revert to an older
version of matplotlib.

this bug doesn’t affect the plots shown in a browser because they don’t use
matplotlib.

1 Like