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.18. nilearn.plotting.view_surf

nilearn.plotting.view_surf(surf_mesh, surf_map=None, bg_map=None, 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 surface map into an HTML page.

surf_mesh: str or list of two numpy.ndarray

Surface mesh geometry, can be a file (valid formats are .gii or Freesurfer specific files such as .orig, .pial, .sphere, .white, .inflated) or a list of two Numpy arrays, the first containing the x-y-z coordinates of the mesh vertices, the second containing the indices (into coords) of the mesh faces.

surf_map: str or numpy.ndarray, optional.

Data to be displayed on the surface mesh. Can be a file (valid formats are .gii, .mgz, .nii, .nii.gz, or Freesurfer specific files such as .thickness, .curv, .sulc, .annot, .label) or a Numpy array

bg_map: Surface data, optional,

Background image to be plotted on the mesh underneath the surf_data in greyscale, most likely a sulcal depth map for realistic shading.

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

You might want to change it to ‘gnist_ncar’ if plotting a surface atlas.

black_bgbool, optional (default=False)

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

symmetric_cmapbool, optional (default=True)

Make colormap symmetric (ranging from -vmax to vmax). Set it to False if you are plotting a surface atlas.

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.

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

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


Surface plot from a 3D statistical map.