class_docstr: An MPL axis-like object that displays a 2D view of 3D volumes.
  
  Parameters
  ----------
  %(ax)s
  direction : {'x', 'y', 'z'}
      The directions of the view.
  
  coord : :obj:`float`
      The coordinate along the direction of the cut.
  %(radiological)s
class_docstr_tok: ["An","MPL","axis-like","object","that","displays","a","2D","view","of","3D","volumes",".","Parameters","--","--","--","--","--","%","(","ax",")","s","direction",":","{","'","x","'",",","'","y","'",",","'","z","'","}","The","directions","of","the","view",".","coord",":",":","obj",":","`","float","`","The","coordinate","along","the","direction","of","the","cut",".","%","(","radiological",")","s"]
docstr: Transform to a 2D.
docstr_tok: ["Transform","to","a","2D","."]
code: def transform_to_2d(self, data, affine):
      """Transform to a 2D."""
      raise NotImplementedError(
          "'transform_to_2d' needs to be implemented in derived classes'"
      )
  
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 BaseAxes obj's underlying member method code with example usage: obj.transform_to_2d(data, affine) without return types