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

nilearn.plotting.view_surf(surf_mesh, surf_map=None, bg_map=None, threshold=None, cmap=<matplotlib.colors.LinearSegmentedColormap object>, black_bg=False, vmax=None, symmetric_cmap=True)

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.

threshold : str, 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.

cmap : str or matplotlib colormap, optional

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

black_bg : bool, optional (default=False)

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

symmetric_cmap : bool, optional (default=True)

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

vmax : float or None, optional (default=None)

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


SurfaceView : plot 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.