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: Return the maximum of the absolute value of the 3D volume         along an axis.
  
  Parameters
  ----------
  data : 3D :class:`numpy.ndarray`
      The 3D volume.
  
  affine : 4x4 :class:`numpy.ndarray`
      The affine of the volume.
docstr_tok: ["Return","the","maximum","of","the","absolute","value","of","the","3D","volume","along","an","axis",".","Parameters","--","--","--","--","--","data",":","3D",":","class",":","`","numpy.ndarray","`","The","3D","volume",".","affine",":","4x4",":","class",":","`","numpy.ndarray","`","The","affine","of","the","volume","."]
code: def transform_to_2d(self, data, affine):
      """Return the maximum of the absolute value of the 3D volume \
          along an axis.
  
          Parameters
          ----------
          data : 3D :class:`numpy.ndarray`
              The 3D volume.
  
          affine : 4x4 :class:`numpy.ndarray`
              The affine of the volume.
  
          """
      if self.direction in "xlr":
          max_axis = 0
      else:
          max_axis = ".yz".index(self.direction)
  
      # set unselected brain hemisphere activations to 0
      if self.direction == "l":
          x_center, _, _, _ = np.dot(
              np.linalg.inv(affine), np.array([0, 0, 0, 1])
          )
          data_selection = data[: int(x_center), :, :]
      elif self.direction == "r":
          x_center, _, _, _ = np.dot(
              np.linalg.inv(affine), np.array([0, 0, 0, 1])
          )
          data_selection = data[int(x_center) :, :, :]
      else:
          data_selection = data
  
      # We need to make sure data_selection is not empty in the x axis
      # This should be the case since we expect images in MNI space
      if data_selection.shape[0] == 0:
          data_selection = data
  
      if not self._plot_abs:
          # get the shape of the array we are projecting to
          new_shape = list(data.shape)
          del new_shape[max_axis]
  
          # generate a 3D indexing array that points to max abs value in the
          # current projection
          a1, a2 = np.indices(new_shape)
          inds = [a1, a2]
          inds.insert(
              max_axis, np.abs(data_selection).argmax(axis=max_axis)
          )
  
          # take the values where the absolute value of the projection
          # is the highest
          maximum_intensity_data = data_selection[tuple(inds)]
      else:
          maximum_intensity_data = np.abs(data_selection).max(
              axis=max_axis
          )
  
      # This work around can be removed bumping matplotlib > 2.1.0. See #1815
      # in nilearn for the invention of this work around
      if (
          self.direction == "l"
          and data_selection.min() is np.ma.masked
          and not (self.ax.get_xlim()[0] > self.ax.get_xlim()[1])
      ):
          self.ax.invert_xaxis()
  
      return np.rot90(maximum_intensity_data)
  
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 2 for calling the GlassBrainAxes obj's underlying member method code with example usage: obj.transform_to_2d(data, affine) and returns: np