class_docstr: An MPL axis-like object that displays a 2D projection of 3D     volumes with a schematic view of the brain.
  
  Parameters
  ----------
  %(ax)s
  direction : {'x', 'y', 'z'}
      The directions of the view.
  
  coord : :obj:`float`
      The coordinate along the direction of the cut.
  
  plot_abs : :obj:`bool`, default=True
      If set to ``True`` the absolute value of the data will be considered.
class_docstr_tok: ["An","MPL","axis-like","object","that","displays","a","2D","projection","of","3D","volumes","with","a","schematic","view","of","the","brain",".","Parameters","--","--","--","--","--","%","(","ax",")","s","direction",":","{","'","x","'",",","'","y","'",",","'","z","'","}","The","directions","of","the","view",".","coord",":",":","obj",":","`","float","`","The","coordinate","along","the","direction","of","the","cut",".","plot_abs",":",":","obj",":","`","bool","`",",","default=True","If","set","to","``","True","``","the","absolute","value","of","the","data","will","be","considered","."]
docstr: Plot lines.
  
  Parameters
  ----------
  line_coords : :obj:`list` of :class:`numpy.ndarray` of shape (2, 3)
      3D coordinates of lines start points and end points.
  
  line_values : array_like
      Values of the lines.
  
  cmap : :class:`~matplotlib.colors.Colormap`
      Colormap used to map ``line_values`` to a color.
  
  vmin, 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 lines. If ``None`` are
      supplied the maximum absolute value within the given threshold
      will be used as minimum (multiplied by -1) and maximum
      coloring levels.
  
  directed : :obj:`bool`, default=False
      Add arrows instead of lines if set to ``True``.
      Use this when plotting directed graphs for example.
  
  
  kwargs : :obj:`dict`
      Additional arguments to pass to :class:`~matplotlib.lines.Line2D`.
docstr_tok: ["Plot","lines",".","Parameters","--","--","--","--","--","line_coords",":",":","obj",":","`","list","`","of",":","class",":","`","numpy.ndarray","`","of","shape","(","2",",","3",")","3D","coordinates","of","lines","start","points","and","end","points",".","line_values",":","array_like","Values","of","the","lines",".","cmap",":",":","class",":","`","~matplotlib.colors.Colormap","`","Colormap","used","to","map","``","line_values","``","to","a","color",".","vmin",",","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","lines",".","If","``","None","``","are","supplied","the","maximum","absolute","value","within","the","given","threshold","will","be","used","as","minimum","(","multiplied","by","-1",")","and","maximum","coloring","levels",".","directed",":",":","obj",":","`","bool","`",",","default=False","Add","arrows","instead","of","lines","if","set","to","``","True","``",".","Use","this","when","plotting","directed","graphs","for","example",".","kwargs",":",":","obj",":","`","dict","`","Additional","arguments","to","pass","to",":","class",":","`","~matplotlib.lines.Line2D","`","."]
code: def _add_lines(
      self,
      line_coords,
      line_values,
      cmap,
      vmin=None,
      vmax=None,
      directed=False,
      **kwargs,
  ):
      """Plot lines.
  
      Parameters
      ----------
      line_coords : :obj:`list` of :class:`numpy.ndarray` of shape (2, 3)
          3D coordinates of lines start points and end points.
  
      line_values : array_like
          Values of the lines.
  
      cmap : :class:`~matplotlib.colors.Colormap`
          Colormap used to map ``line_values`` to a color.
  
      vmin, 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 lines. If ``None`` are
          supplied the maximum absolute value within the given threshold
          will be used as minimum (multiplied by -1) and maximum
          coloring levels.
  
      directed : :obj:`bool`, default=False
          Add arrows instead of lines if set to ``True``.
          Use this when plotting directed graphs for example.
  
  
      kwargs : :obj:`dict`
          Additional arguments to pass to :class:`~matplotlib.lines.Line2D`.
  
      """
      # colormap for colorbar
      self.cmap = cmap
      if vmin is None and vmax is None:
          abs_line_values_max = np.abs(line_values).max()
          vmin = -abs_line_values_max
          vmax = abs_line_values_max
      elif vmin is None:
          if vmax > 0:
              vmin = -vmax
          else:
              raise ValueError(
                  "If vmax is set to a non-positive number "
                  "then vmin needs to be specified"
              )
      elif vmax is None:
          if vmin < 0:
              vmax = -vmin
          else:
              raise ValueError(
                  "If vmin is set to a non-negative number "
                  "then vmax needs to be specified"
              )
      norm = Normalize(vmin=vmin, vmax=vmax)
      # normalization useful for colorbar
      self.norm = norm
      abs_norm = Normalize(vmin=0, vmax=max(abs(vmax), abs(vmin)))
      value_to_color = plt.cm.ScalarMappable(
          norm=norm, cmap=cmap
      ).to_rgba
  
      # Allow lines only in their respective hemisphere when appropriate
      if self.direction in "lr":
          relevant_lines = []
          for lidx, line in enumerate(line_coords):
              if self.direction == "r":
                  if line[0, 0] >= 0 and line[1, 0] >= 0:
                      relevant_lines.append(lidx)
              elif self.direction == "l":
                  if line[0, 0] < 0 and line[1, 0] < 0:
                      relevant_lines.append(lidx)
          line_coords = np.array(line_coords)[relevant_lines]
          line_values = line_values[relevant_lines]
  
      for start_end_point_3d, line_value in zip(
          line_coords, line_values
      ):
          start_end_point_2d = coords_3d_to_2d(
              start_end_point_3d, self.direction
          )
  
          color = value_to_color(line_value)
          abs_line_value = abs(line_value)
          linewidth = 1 + 2 * abs_norm(abs_line_value)
          # Hacky way to put the strongest connections on top of the weakest
          # note sign does not matter hence using 'abs'
          zorder = 10 + 10 * abs_norm(abs_line_value)
          this_kwargs = {
              "color": color,
              "linewidth": linewidth,
              "zorder": zorder,
          }
          # kwargs should have priority over this_kwargs so that the
          # user can override the default logic
          this_kwargs.update(kwargs)
          xdata, ydata = start_end_point_2d.T
          # If directed is True, add an arrow
          if directed:
              dx = xdata[1] - xdata[0]
              dy = ydata[1] - ydata[0]
              # Hack to avoid empty arrows to crash with
              # matplotlib versions older than 3.1
              # This can be removed once support for
              # matplotlib pre 3.1 has been dropped.
              if dx == dy == 0:
                  arrow = FancyArrow(xdata[0], ydata[0], dx, dy)
              else:
                  arrow = FancyArrow(
                      xdata[0],
                      ydata[0],
                      dx,
                      dy,
                      length_includes_head=True,
                      width=linewidth,
                      head_width=3 * linewidth,
                      **this_kwargs,
                  )
              self.ax.add_patch(arrow)
          # Otherwise a line
          else:
              line = Line2D(xdata, ydata, **this_kwargs)
              self.ax.add_line(line)
  
imports: import numbers
  import matplotlib.pyplot
  import numpy
  from matplotlib.colors import Normalize
  from matplotlib.font_manager import FontProperties
  from matplotlib.lines import Line2D
  from matplotlib.patches import FancyArrow
  from mpl_toolkits.axes_grid1.anchored_artists import AnchoredSizeBar
  from nilearn._utils.docs import fill_doc
  from nilearn.image import coord_transform
  from nilearn.plotting.glass_brain import plot_brain_schematics
label_desc: Use image node_id 5 for calling the GlassBrainAxes obj's underlying member method code with example usage: obj._add_lines(line_coords, line_values, cmap, vmin, vmax, directed) without return types