Note

This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the user guide for the big picture.

8.10.21. nilearn.plotting.plot_img_on_surf

nilearn.plotting.plot_img_on_surf(stat_map, surf_mesh='fsaverage5', mask_img=None, hemispheres=['left', 'right'], inflate=False, views=['lateral', 'medial'], output_file=None, title=None, colorbar=True, vmax=None, threshold=None, cmap='cold_hot', aspect_ratio=1.4, **kwargs)

Convenience function to plot multiple views of plot_surf_stat_map in a single figure. It projects stat_map into meshes and plots views of left and right hemispheres. The views argument defines the views that are shown. This function returns the fig, axes elements from matplotlib unless kwargs sets and output_file, in which case nothing is returned.

stat_map : str or 3D Niimg-like object
See http://nilearn.github.io/manipulating_images/input_output.html
surf_mesh : str, dict, or None, default is ‘fsaverage5’
If str, either one of the two: ‘fsaverage5’: the low-resolution fsaverage5 mesh (10242 nodes) ‘fsaverage’: the high-resolution fsaverage mesh (163842 nodes) If dict, a dictionary with keys: [‘infl_left’, ‘infl_right’, ‘pial_left’, ‘pial_right’, ‘sulc_left’, ‘sulc_right’], where values are surface mesh geometries as accepted by plot_surf_stat_map.
mask_img : Niimg-like object or None, optional (default=None)
The mask is passed to vol_to_surf. Samples falling out of this mask or out of the image are ignored during projection of the volume to the surface. If None, don’t apply any mask.
inflate : bool, optional (default=False)
If True, display images in inflated brain. If False, display images in pial surface.
views : list, optional (default=[‘lateral’, ‘medial’])
A list containing all views to display. The montage will contain as many rows as views specified by display mode. Order is preserved, and left and right hemispheres are shown on the left and right sides of the figure.
hemispheres : list, optional (default=[‘left’, ‘right’])
Hemispheres to display
output_file : str, optional (default=None)
The name of an image file to export plot to. Valid extensions are: .png, .pdf, .svg. If output_file is not None, the plot is saved to a file, and the display is closed. Return value is None.
title : str, optional (default=None)
Place a title on the upper center of the figure.
colorbar : bool, optional (default=True)
If True, a symmetric colorbar of the statistical map is displayed.
vmax : float, optional (default=None)
Upper bound for plotting of stat_map values.
threshold : float, optional (default=None)
If None is given, the image is not thresholded. If a number is given, it is used to threshold the image, values below the threshold (in absolute value) are plotted as transparent.
cmap : str, optional (default=’cold_hot’)
The name of a matplotlib or nilearn colormap.
kwargs : dict
keyword arguments passed to plot_surf_stat_map.

See also

nilearn.datasets.fetch_surf_fsaverage
For surface data object to be used as the default background map for this plotting function.
nilearn.surface.vol_to_surf
For info on the generation of surfaces.
nilearn.plotting.plot_surf_stat_map
For info on kwargs options accepted by plot_img_on_surf.

8.10.21.1. Examples using nilearn.plotting.plot_img_on_surf