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.

7.10.19. nilearn.plotting.view_img_on_surf

nilearn.plotting.view_img_on_surf(stat_map_img, surf_mesh='fsaverage5', threshold=None, cmap=<matplotlib.colors.LinearSegmentedColormap object at 0x7f676c650c90>, black_bg=False, vmax=None, vmin=None, symmetric_cmap=True, colorbar=True, colorbar_height=0.5, colorbar_fontsize=25, title=None, title_fontsize=25)

Insert a surface plot of a statistical map into an HTML page.

Parameters
stat_map_imgNiimg-like object, 3D

See http://nilearn.github.io/manipulating_images/input_output.html

surf_meshstr or dict, optional.

if ‘fsaverage5’, use fsaverage5 mesh from nilearn.datasets if ‘fsaverage’, use fsaverage mesh from nilearn.datasets if a dictionary, it should have the same structure as those returned by nilearn.datasets.fetch_surf_fsaverage, i.e. keys should be ‘infl_left’, ‘pial_left’, ‘sulc_left’, ‘infl_right’, ‘pial_right’, and ‘sulc_right’, containing inflated and pial meshes, and sulcal depth values for left and right hemispheres.

thresholdstr, number or None, optional (default=None)

If None, no thresholding. If it is a number only values of amplitude greater than threshold will be shown. If it is a string it must finish with a percent sign, e.g. “25.3%”, and only values of amplitude above the given percentile will be shown.

cmapstr or matplotlib colormap, optional
black_bgbool, optional (default=False)

If True, image is plotted on a black background. Otherwise on a white background.

vmaxfloat or None, optional (default=None)

upper bound for the colorbar. if None, use the absolute max of the brain map.

vminfloat, or None (default=None)

min value for mapping colors. If symmetric_cmap is True, vmin is always equal to -vmax and cannot be chosen. If symmetric_cmap is False, vmin defaults to the min of the image, or 0 when a threshold is used.

symmetric_cmapbool, optional (default=True)

Make colormap symmetric (ranging from -vmax to vmax). You can set it to False if you are plotting only positive values.

colorbarbool, optional (default=True)

add a colorbar

colorbar_heightfloat, optional (default=.5)

height of the colorbar, relative to the figure height

colorbar_fontsizeint, optional (default=25)

fontsize of the colorbar tick labels

titlestr, optional (default=None)

title for the plot

title_fontsizeint, optional (default=25)

fontsize of the title

Returns
SurfaceViewplot of the stat map.

It can be saved as an html page or rendered (transparently) by the Jupyter notebook. Useful methods are :

  • ‘resize’ to resize the plot displayed in a Jupyter notebook

  • ‘save_as_html’ to save the plot to a file

  • ‘open_in_browser’ to save the plot and open it in a web browser.

See also

nilearn.plotting.view_surf

plot from a surface map on a cortical mesh.

7.10.19.1. Examples using nilearn.plotting.view_img_on_surf