class_docstr: A class to create linked axes for plotting orthogonal projections     of 3D maps.
  
  This visualization mode can be activated from
  :func:`~nilearn.plotting.plot_glass_brain`, by setting
  ``display_mode='ortho'``:
  
    .. code-block:: python
  
        from nilearn.datasets import load_mni152_template
        from nilearn.plotting import plot_glass_brain
  
        img = load_mni152_template()
        # display is an instance of the OrthoProjector class
        display = plot_glass_brain(img, display_mode="ortho")
  
  Attributes
  ----------
  axes : :obj:`dict` of :class:`~nilearn.plotting.displays.GlassBrainAxes`
      The 3 axes used to plot each view ('x', 'y', and 'z').
  
  frame_axes : :class:`~matplotlib.axes.Axes`
      The axes framing the whole set of views.
docstr: Plot undirected graph on each of the axes.
  
  Parameters
  ----------
  adjacency_matrix : :class:`numpy.ndarray` of shape ``(n, n)``
      Represents the edges strengths of the graph.
      The matrix can be symmetric which will result in
      an undirected graph, or not symmetric which will
      result in a directed graph.
  
  node_coords : :class:`numpy.ndarray` of shape ``(n, 3)``
      3D coordinates of the graph nodes in world space.
  
  node_color : color or sequence of colors, default='auto'
      Color(s) of the nodes.
  
  node_size : scalar or array_like, default=50
      Size(s) of the nodes in points^2.
  
  edge_cmap : :class:`~matplotlib.colors.Colormap`, default=cm.bwr
      Colormap used for representing the strength of the edges.
  
  
  edge_vmin, edge_vmax : :obj:`float`, optional
      - If not ``None``, either or both of these values will be used
        to as the minimum and maximum values to color edges.
      - If ``None`` are supplied, the maximum absolute value within the
        given threshold will be used as minimum (multiplied by -1) and
        maximum coloring levels.
  
  edge_threshold : :obj:`str` or :obj:`int` or :obj:`float`, optional
      - If it is a number only the edges with a value greater than
        ``edge_threshold`` will be shown.
      - If it is a string it must finish with a percent sign,
        e.g. "25.3%", and only the edges with a abs(value) above
        the given percentile will be shown.
  
  edge_kwargs : :obj:`dict`, optional
      Will be passed as kwargs for each edge
      :class:`~matplotlib.lines.Line2D`.
  
  node_kwargs : :obj:`dict`
      Will be passed as kwargs to the function
      :func:`~matplotlib.pyplot.scatter` which plots all the
      nodes at one.
docstr_tok: ["Plot","undirected","graph","on","each","of","the","axes",".","Parameters","--","--","--","--","--","adjacency_matrix",":",":","class",":","`","numpy.ndarray","`","of","shape","``","(","n",",","n",")","``","Represents","the","edges","strengths","of","the","graph",".","The","matrix","can","be","symmetric","which","will","result","in","an","undirected","graph",",","or","not","symmetric","which","will","result","in","a","directed","graph",".","node_coords",":",":","class",":","`","numpy.ndarray","`","of","shape","``","(","n",",","3",")","``","3D","coordinates","of","the","graph","nodes","in","world","space",".","node_color",":","color","or","sequence","of","colors",",","default='auto'","Color","(","s",")","of","the","nodes",".","node_size",":","scalar","or","array_like",",","default=50","Size","(","s",")","of","the","nodes","in","points^2",".","edge_cmap",":",":","class",":","`","~matplotlib.colors.Colormap","`",",","default=cm.bwr","Colormap","used","for","representing","the","strength","of","the","edges",".","edge_vmin",",","edge_vmax",":",":","obj",":","`","float","`",",","optional","-","If","not","``","None","``",",","either","or","both","of","these","values","will","be","used","to","as","the","minimum","and","maximum","values","to","color","edges",".","-","If","``","None","``","are","supplied",",","the","maximum","absolute","value","within","the","given","threshold","will","be","used","as","minimum","(","multiplied","by","-1",")","and","maximum","coloring","levels",".","edge_threshold",":",":","obj",":","`","str","`","or",":","obj",":","`","int","`","or",":","obj",":","`","float","`",",","optional","-","If","it","is","a","number","only","the","edges","with","a","value","greater","than","``","edge_threshold","``","will","be","shown",".","-","If","it","is","a","string","it","must","finish","with","a","percent","sign",",","e.g",".","``","25.3","%","''",",","and","only","the","edges","with","a","abs","(","value",")","above","the","given","percentile","will","be","shown",".","edge_kwargs",":",":","obj",":","`","dict","`",",","optional","Will","be","passed","as","kwargs","for","each","edge",":","class",":","`","~matplotlib.lines.Line2D","`",".","node_kwargs",":",":","obj",":","`","dict","`","Will","be","passed","as","kwargs","to","the","function",":","func",":","`","~matplotlib.pyplot.scatter","`","which","plots","all","the","nodes","at","one","."]
code: def add_graph(
      self,
      adjacency_matrix,
      node_coords,
      node_color="auto",
      node_size=50,
      edge_cmap=cm.bwr,
      edge_vmin=None,
      edge_vmax=None,
      edge_threshold=None,
      edge_kwargs=None,
      node_kwargs=None,
      colorbar=False,
  ):
      """Plot undirected graph on each of the axes.
  
      Parameters
      ----------
      adjacency_matrix : :class:`numpy.ndarray` of shape ``(n, n)``
          Represents the edges strengths of the graph.
          The matrix can be symmetric which will result in
          an undirected graph, or not symmetric which will
          result in a directed graph.
  
      node_coords : :class:`numpy.ndarray` of shape ``(n, 3)``
          3D coordinates of the graph nodes in world space.
  
      node_color : color or sequence of colors, default='auto'
          Color(s) of the nodes.
  
      node_size : scalar or array_like, default=50
          Size(s) of the nodes in points^2.
  
      edge_cmap : :class:`~matplotlib.colors.Colormap`, default=cm.bwr
          Colormap used for representing the strength of the edges.
  
  
      edge_vmin, edge_vmax : :obj:`float`, optional
          - If not ``None``, either or both of these values will be used
            to as the minimum and maximum values to color edges.
          - If ``None`` are supplied, the maximum absolute value within the
            given threshold will be used as minimum (multiplied by -1) and
            maximum coloring levels.
  
      edge_threshold : :obj:`str` or :obj:`int` or :obj:`float`, optional
          - If it is a number only the edges with a value greater than
            ``edge_threshold`` will be shown.
          - If it is a string it must finish with a percent sign,
            e.g. "25.3%", and only the edges with a abs(value) above
            the given percentile will be shown.
  
      edge_kwargs : :obj:`dict`, optional
          Will be passed as kwargs for each edge
          :class:`~matplotlib.lines.Line2D`.
  
      node_kwargs : :obj:`dict`
          Will be passed as kwargs to the function
          :func:`~matplotlib.pyplot.scatter` which plots all the
          nodes at one.
      """
      # set defaults
      if edge_kwargs is None:
          edge_kwargs = {}
      if node_kwargs is None:
          node_kwargs = {}
      if isinstance(node_color, str) and node_color == "auto":
          nb_nodes = len(node_coords)
          node_color = mpl_cm.Set2(np.linspace(0, 1, nb_nodes))
      node_coords = np.asarray(node_coords)
  
      # decompress input matrix if sparse
      if issparse(adjacency_matrix):
          adjacency_matrix = adjacency_matrix.toarray()
  
      # make the lines below well-behaved
      adjacency_matrix = np.nan_to_num(adjacency_matrix)
  
      # safety checks
      if "s" in node_kwargs:
          raise ValueError(
              "Please use 'node_size' and not 'node_kwargs' "
              "to specify node sizes"
          )
      if "c" in node_kwargs:
          raise ValueError(
              "Please use 'node_color' and not 'node_kwargs' "
              "to specify node colors"
          )
  
      adjacency_matrix_shape = adjacency_matrix.shape
      if (
          len(adjacency_matrix_shape) != 2
          or adjacency_matrix_shape[0] != adjacency_matrix_shape[1]
      ):
          raise ValueError(
              "'adjacency_matrix' is supposed to have shape (n, n)."
              f" Its shape was {adjacency_matrix_shape}"
          )
  
      node_coords_shape = node_coords.shape
      if len(node_coords_shape) != 2 or node_coords_shape[1] != 3:
          message = (
              "Invalid shape for 'node_coords'. You passed an "
              "'adjacency_matrix' of shape {0} therefore "
              "'node_coords' should be a array with shape ({0[0]}, 3) "
              "while its shape was {1}"
          ).format(adjacency_matrix_shape, node_coords_shape)
  
          raise ValueError(message)
  
      if (
          isinstance(node_color, (list, np.ndarray))
          and len(node_color) != 1
      ):
          if len(node_color) != node_coords_shape[0]:
              raise ValueError(
                  "Mismatch between the number of nodes "
                  f"({node_coords_shape[0]}) "
                  f"and the number of node colors ({len(node_color)})."
              )
  
      if node_coords_shape[0] != adjacency_matrix_shape[0]:
          raise ValueError(
              "Shape mismatch between 'adjacency_matrix' "
              "and 'node_coords'"
              f"'adjacency_matrix' shape is {adjacency_matrix_shape}, "
              f"'node_coords' shape is {node_coords_shape}"
          )
  
      # If the adjacency matrix is not symmetric, give a warning
      symmetric = True
      if not np.allclose(
          adjacency_matrix, adjacency_matrix.T, rtol=1e-3
      ):
          symmetric = False
          warnings.warn(
              "'adjacency_matrix' is not symmetric. "
              "A directed graph will be plotted."
          )
  
      # For a masked array, masked values are replaced with zeros
      if hasattr(adjacency_matrix, "mask"):
          if not (
              adjacency_matrix.mask == adjacency_matrix.mask.T
          ).all():
              symmetric = False
              warnings.warn(
                  "'adjacency_matrix' was masked with "
                  "a non symmetric mask. A directed "
                  "graph will be plotted."
              )
          adjacency_matrix = adjacency_matrix.filled(0)
  
      if edge_threshold is not None:
          if symmetric:
              # Keep a percentile of edges with the highest absolute
              # values, so only need to look at the covariance
              # coefficients below the diagonal
              lower_diagonal_indices = np.tril_indices_from(
                  adjacency_matrix, k=-1
              )
              lower_diagonal_values = adjacency_matrix[
                  lower_diagonal_indices
              ]
              edge_threshold = check_threshold(
                  edge_threshold,
                  np.abs(lower_diagonal_values),
                  scoreatpercentile,
                  "edge_threshold",
              )
          else:
              edge_threshold = check_threshold(
                  edge_threshold,
                  np.abs(adjacency_matrix.ravel()),
                  scoreatpercentile,
                  "edge_threshold",
              )
  
          adjacency_matrix = adjacency_matrix.copy()
          threshold_mask = np.abs(adjacency_matrix) < edge_threshold
          adjacency_matrix[threshold_mask] = 0
  
      if symmetric:
          lower_triangular_adjacency_matrix = np.tril(
              adjacency_matrix, k=-1
          )
          non_zero_indices = lower_triangular_adjacency_matrix.nonzero()
      else:
          non_zero_indices = adjacency_matrix.nonzero()
  
      line_coords = [
          node_coords[list(index)] for index in zip(*non_zero_indices)
      ]
  
      adjacency_matrix_values = adjacency_matrix[non_zero_indices]
      for ax in self.axes.values():
          ax._add_markers(
              node_coords, node_color, node_size, **node_kwargs
          )
          if line_coords:
              ax._add_lines(
                  line_coords,
                  adjacency_matrix_values,
                  edge_cmap,
                  vmin=edge_vmin,
                  vmax=edge_vmax,
                  directed=(not symmetric),
                  **edge_kwargs,
              )
          # To obtain the brain left view, we simply invert the x axis
          if ax.direction == "l" and not (
              ax.ax.get_xlim()[0] > ax.ax.get_xlim()[1]
          ):
              ax.ax.invert_xaxis()
  
      if colorbar:
          self._colorbar = colorbar
          self._show_colorbar(
              ax.cmap, ax.norm, threshold=edge_threshold
          )
  
      plt.draw_if_interactive()
  
imports: import warnings
  import matplotlib.pyplot
  import numpy
  from matplotlib import cm
  from scipy.sparse import issparse
  from scipy.stats import scoreatpercentile
  from nilearn._utils.param_validation import check_threshold
  from nilearn.plotting import cm
  from nilearn.plotting.displays._axes import GlassBrainAxes
  from nilearn.plotting.displays._slicers import OrthoSlicer, _get_create_display_fun
label_desc: Use image node_id 3 for calling the OrthoProjector obj's underlying member method code with example usage: obj.add_graph(adjacency_matrix, node_coords, node_color, node_size, edge_cmap, edge_vmin, edge_vmax, edge_threshold, edge_kwargs, node_kwargs, colorbar) without return types