code: def view_surf(
      surf_mesh,
      surf_map=None,
      bg_map=None,
      threshold=None,
      cmap=cm.cold_hot,
      black_bg=False,
      vmax=None,
      vmin=None,
      bg_on_data=False,
      darkness=0.7,
      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.
  
      Parameters
      ----------
      surf_mesh : str or list of two numpy.ndarray
          Surface :term:`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 :term:`mesh` vertices, the second containing the indices
          (into coords) of the :term:`mesh` :term:`faces`.
  
      surf_map : str or numpy.ndarray, optional
          Data to be displayed on the surface :term:`mesh`.
          Can be a file (valid formats are .gii, .mgz, .nii, .nii.gz,
          or Freesurfer specific files such as
          .thickness, .area, .curv, .sulc, .annot, .label) or
          a Numpy array
  
      bg_map : str or numpy.ndarray, default=None
          Background image to be plotted on the :term:`mesh` underneath
          the surf_data in greyscale, most likely a sulcal depth map for
          realistic shading.
          If the map contains values outside [0, 1],
          it will be rescaled such that all values are in [0, 1].
          Otherwise, it will not be modified.
  
      %(bg_on_data)s
  
      %(darkness)s
          Default=1.
  
      threshold : str, number or None, optional
          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, default=cm.cold_hot
          You might want to change it to 'gnist_ncar' if plotting a
          surface atlas.
  
      black_bg : bool, default=False
          If True, image is plotted on a black background. Otherwise on a
          white background.
  
      symmetric_cmap : bool, 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
          upper bound for the colorbar. if None, use the absolute max of the
          brain map.
  
      vmin : float or None, optional
          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.
  
      colorbar : bool, default=True
          Add a colorbar or not.
  
      colorbar_height : float, default=0.5
          Height of the colorbar, relative to the figure height.
  
      colorbar_fontsize : int, default=25
          Fontsize of the colorbar tick labels.
  
      title : str, optional
          Title for the plot.
  
      title_fontsize : int, default=25
          Fontsize of the title.
  
      Returns
      -------
      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
      --------
      nilearn.plotting.view_img_on_surf: Surface plot from a 3D statistical map.
  
      """
      surf_mesh = surface.load_surf_mesh(surf_mesh)
      if surf_map is None:
          surf_map = np.ones(len(surf_mesh[0]))
      else:
          surf_mesh, surf_map = surface.check_mesh_and_data(
              surf_mesh, surf_map
          )
      if bg_map is not None:
          _, bg_map = surface.check_mesh_and_data(surf_mesh, bg_map)
      info = _one_mesh_info(
          surf_map=surf_map,
          surf_mesh=surf_mesh,
          threshold=threshold,
          cmap=cmap,
          black_bg=black_bg,
          bg_map=bg_map,
          bg_on_data=bg_on_data,
          darkness=darkness,
          symmetric_cmap=symmetric_cmap,
          vmax=vmax,
          vmin=vmin,
      )
      info["colorbar"] = colorbar
      info["cbar_height"] = colorbar_height
      info["cbar_fontsize"] = colorbar_fontsize
      info["title"] = title
      info["title_fontsize"] = title_fontsize
      return _fill_html_template(info, embed_js=True)
  
imports: import collections.abc
  import json
  from warnings import warn
  import matplotlib
  import matplotlib.pyplot
  import numpy
  from nilearn import datasets, surface
  from nilearn._utils import fill_doc
  from nilearn._utils.niimg_conversions import check_niimg_3d
  from nilearn.plotting import cm
  from nilearn.plotting.html_document import HTMLDocument
  from nilearn.plotting.js_plotting_utils import add_js_lib, colorscale, get_html_template, mesh_to_plotly, to_color_strings
label_desc: Use image node_id 9 for calling a global function with example usage: view_surf(surf_mesh, surf_map, bg_map, threshold, cmap, black_bg, vmax, vmin, bg_on_data, darkness, symmetric_cmap, colorbar, colorbar_height, colorbar_fontsize, title, title_fontsize) and returns: _fill_html_template