Show nilearn plots from both sides in sagittal view

Hello,

I wanted to generate a figure showing the left side of the brain with an stat map plot from the lateral view, but it always shows the image from the inside, the brain facing to the right. I wish to keep the colorbar as well on the right side.
leftIFOF
Is there an easy way to make the brain look to the other side so it shows the left hemisphere from the outside?

Thanks,
Marc.

Sorry, I have no simple solution to that. I would do it in a dirty way by writing the image to disk (without colorbar), then use matplotlib read_img and display the image values flipped horizontally, and finally add the colorbar…

how about just swapping the limits of the matplotlib axis?

from nilearn import datasets, plotting

mni = datasets.load_mni152_template()
display = plotting.plot_stat_map(mni, display_mode="x", cut_coords=[0])
ax = list(display.axes.values())[0].ax
ax.set_xlim(*ax.get_xlim()[::-1])
display.savefig("/tmp/fig.png")

fig

1 Like

I was also playing around by flipping the data array but the axis flip looks good!
Thank you.

1 Like