Custom colorbar in niilearn.plotting.plot_glass_brain



Hi everyone,
I would like to graphically present some results of mine using the plot_glass_brain function from the niilearn.plotting module. I have noticed that there is no way of customizing the colorbar (i.e. it will always range from the minimum to the maximum values in the image you’re plotting). However, I would like to have a consistent colorbar (and thus color map, of course) ranging from 0 to 1 for all my images (that show indeed the frequency of occurrence of voxels). Before getting messy and trying to change the code myself I wanted to ask if some of you have already (successfully) tried to do the same thing and if this someone care to share his/her solution.
Thanks a lot



I think that what you are looking for are the “vmin” and “vmax” option of plot_glass_brain.


Thanks a lot Gael, I think I misinterpreted the help for the parameter “symmetric_cbar” where it says “Note: The colormap will always be set to range from -vmax to vmax”.

Now I got exactly what I wanted, that is pretty nice.