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.
nilearn.plotting.plot_surf_contours¶
- nilearn.plotting.plot_surf_contours(surf_mesh=None, roi_map=None, hemi='left', levels=None, labels=None, colors=None, legend=False, cmap='tab20', title=None, output_file=None, axes=None, figure=None, **kwargs)[source]¶
Plot contours of ROIs on a surface, optionally over a statistical map.
- Parameters:
- surf_mesh
strorlistof twonumpy.ndarrayor aInMemoryMesh, or aPolyMesh, or None, default=None 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, or a
InMemoryMeshobject with “coordinates” and “faces” attributes, or aPolyMeshobject, or None. If None is passed, thenroi_mapmust be aSurfaceImageinstance and the mesh from thatSurfaceImageinstance will be used.- roi_map
strornumpy.ndarrayorSurfaceImageor None, default=None ROI map to be displayed on the surface mesh, can be a file (valid formats are .gii, .mgz, or Freesurfer specific files such as .thickness, .area, .curv, .sulc, .annot, .label) or a Numpy array with a value for each vertex of the surf_mesh. The value at each vertex one inside the ROI and zero inside ROI, or an integer giving the label number for atlases. If None is passed for
surf_meshthenroi_mapmust be aSurfaceImageinstance and its the mesh will be used for plotting.When specified roi_map is of type
numpy.ndarray, to have a correct view, hemi should have a value corresponding to roi_map data.- hemi{“left”, “right”, “both”}, default=”left”
Hemisphere to display. It is only used if
roi_mapisSurfaceImageand / orsurf_meshisPolyMesh. Otherwise a warning will be displayed.Added in version 0.11.0.
- levels
listofint, or None, default=None A list of indices of the regions that are to be outlined. Every index needs to correspond to one index in
roi_map. If None, all regions inroi_mapare used.- labels
listofstror None, or None, default=None A list of labels for the individual regions of interest. Provide None as list entry to skip showing the label of that region. If None, no labels are used.
- colors
listof matplotlib color names or RGBA values, or None, default=None Colors to be used.
- legend
bool, default=False Whether to plot a legend of region’s labels.
- cmap
matplotlib.colors.Colormap, orstr, optional The colormap to use. Either a string which is a name of a matplotlib colormap, or a matplotlib colormap object. Default=’tab20’.
- title
str, or None, default=None The title displayed on the figure.
- output_file
strorpathlib.Pathor None, optional The name of an image file to export the 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.
- axesinstance of matplotlib axes or None, default=None
The axes instance to plot to. The projection must be “3d” (e.g., figure, axes = plt.subplots(subplot_kw={‘projection’: “3d”}), where axes should be passed.). If None, uses axes from figure if available, else creates new axes.
- figure
int, ormatplotlib.figure.Figure, or None, optional Matplotlib figure used or its number. If None is given, a new figure is created.
- kwargsextra keyword arguments, optional
Extra keyword arguments passed to
plot_surf.
- surf_mesh
See also
nilearn.datasets.fetch_surf_fsaverageFor surface data object to be used as background map for this plotting function.
nilearn.plotting.plot_surf_stat_mapfor plotting statistical maps on brain surfaces.
nilearn.surface.vol_to_surfFor info on the generation of surfaces.