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: Add a scale bar annotation to the display.
  
  Parameters
  ----------
  bg_color : matplotlib color: :obj:`str` or (r, g, b) value
      The background color of the scale bar annotation.
  
  size : :obj:`float`, default=5.0
      Horizontal length of the scale bar, given in `units`.
  
  
  units : :obj:`str`, default='cm'
      Physical units of the scale bar (`'cm'` or `'mm'`).
  
  
  fontproperties : :class:`~matplotlib.font_manager.FontProperties`        or :obj:`dict`, optional
      Font properties for the label text.
  
  frameon : :obj:`bool`, default=False
      Whether the scale bar is plotted with a border.
  
  loc : :obj:`int`, default=4
      Location of this scale bar. Valid location codes are documented
      `here <https://matplotlib.org/mpl_toolkits/axes_grid/            api/anchored_artists_api.html#mpl_toolkits.axes_grid1.            anchored_artists.AnchoredSizeBar>`__.
  
  
  pad : :obj:`int` or :obj:`float`, default=0.1
      Padding around the label and scale bar, in fraction of the font
      size.
  
  borderpad : :obj:`int` or :obj:`float`, default=0.5
      Border padding, in fraction of the font size.
  
  sep : :obj:`int` or :obj:`float`, default=5
      Separation between the label and the scale bar, in points.
  
  
  size_vertical : :obj:`int` or :obj:`float`, default=0
      Vertical length of the size bar, given in `units`.
  
  
  label_top : :obj:`bool`, default=False
      If ``True``, the label will be over the scale bar.
  
  
  color : :obj:`str`, default='black'
      Color for the scale bar and label.
  
  fontsize : :obj:`int`, optional
      Label font size (overwrites the size passed in through the
      ``fontproperties`` argument).
  
  **kwargs :
      Keyworded arguments to pass to
      :class:`~matplotlib.offsetbox.AnchoredOffsetbox`.
docstr_tok: ["Add","a","scale","bar","annotation","to","the","display",".","Parameters","--","--","--","--","--","bg_color",":","matplotlib","color",":",":","obj",":","`","str","`","or","(","r",",","g",",","b",")","value","The","background","color","of","the","scale","bar","annotation",".","size",":",":","obj",":","`","float","`",",","default=5.0","Horizontal","length","of","the","scale","bar",",","given","in","`","units","`",".","units",":",":","obj",":","`","str","`",",","default='cm'","Physical","units","of","the","scale","bar","(","`","'cm","'","`","or","`","'mm","'","`",")",".","fontproperties",":",":","class",":","`","~matplotlib.font_manager.FontProperties","`","or",":","obj",":","`","dict","`",",","optional","Font","properties","for","the","label","text",".","frameon",":",":","obj",":","`","bool","`",",","default=False","Whether","the","scale","bar","is","plotted","with","a","border",".","loc",":",":","obj",":","`","int","`",",","default=4","Location","of","this","scale","bar",".","Valid","location","codes","are","documented","`","here","<","https",":","\/\/matplotlib.org\/mpl_toolkits\/axes_grid\/","api\/anchored_artists_api.html","#","mpl_toolkits.axes_grid1",".","anchored_artists.AnchoredSizeBar",">","`","__",".","pad",":",":","obj",":","`","int","`","or",":","obj",":","`","float","`",",","default=0.1","Padding","around","the","label","and","scale","bar",",","in","fraction","of","the","font","size",".","borderpad",":",":","obj",":","`","int","`","or",":","obj",":","`","float","`",",","default=0.5","Border","padding",",","in","fraction","of","the","font","size",".","sep",":",":","obj",":","`","int","`","or",":","obj",":","`","float","`",",","default=5","Separation","between","the","label","and","the","scale","bar",",","in","points",".","size_vertical",":",":","obj",":","`","int","`","or",":","obj",":","`","float","`",",","default=0","Vertical","length","of","the","size","bar",",","given","in","`","units","`",".","label_top",":",":","obj",":","`","bool","`",",","default=False","If","``","True","``",",","the","label","will","be","over","the","scale","bar",".","color",":",":","obj",":","`","str","`",",","default='black'","Color","for","the","scale","bar","and","label",".","fontsize",":",":","obj",":","`","int","`",",","optional","Label","font","size","(","overwrites","the","size","passed","in","through","the","``","fontproperties","``","argument",")",".","*","*","kwargs",":","Keyworded","arguments","to","pass","to",":","class",":","`","~matplotlib.offsetbox.AnchoredOffsetbox","`","."]
code: def draw_scale_bar(
      self,
      bg_color,
      size=5.0,
      units="cm",
      fontproperties=None,
      frameon=False,
      loc=4,
      pad=0.1,
      borderpad=0.5,
      sep=5,
      size_vertical=0,
      label_top=False,
      color="black",
      fontsize=None,
      **kwargs,
  ):
      """Add a scale bar annotation to the display.
  
          Parameters
          ----------
          bg_color : matplotlib color: :obj:`str` or (r, g, b) value
              The background color of the scale bar annotation.
  
          size : :obj:`float`, default=5.0
              Horizontal length of the scale bar, given in `units`.
  
  
          units : :obj:`str`, default='cm'
              Physical units of the scale bar (`'cm'` or `'mm'`).
  
  
          fontproperties : :class:`~matplotlib.font_manager.FontProperties`\
          or :obj:`dict`, optional
              Font properties for the label text.
  
          frameon : :obj:`bool`, default=False
              Whether the scale bar is plotted with a border.
  
          loc : :obj:`int`, default=4
              Location of this scale bar. Valid location codes are documented
              `here <https://matplotlib.org/mpl_toolkits/axes_grid/\
              api/anchored_artists_api.html#mpl_toolkits.axes_grid1.\
              anchored_artists.AnchoredSizeBar>`__.
  
  
          pad : :obj:`int` or :obj:`float`, default=0.1
              Padding around the label and scale bar, in fraction of the font
              size.
  
          borderpad : :obj:`int` or :obj:`float`, default=0.5
              Border padding, in fraction of the font size.
  
          sep : :obj:`int` or :obj:`float`, default=5
              Separation between the label and the scale bar, in points.
  
  
          size_vertical : :obj:`int` or :obj:`float`, default=0
              Vertical length of the size bar, given in `units`.
  
  
          label_top : :obj:`bool`, default=False
              If ``True``, the label will be over the scale bar.
  
  
          color : :obj:`str`, default='black'
              Color for the scale bar and label.
  
          fontsize : :obj:`int`, optional
              Label font size (overwrites the size passed in through the
              ``fontproperties`` argument).
  
          **kwargs :
              Keyworded arguments to pass to
              :class:`~matplotlib.offsetbox.AnchoredOffsetbox`.
  
          """
      axis = self.ax
      fontproperties = fontproperties or FontProperties()
      if fontsize:
          fontproperties.set_size(fontsize)
      width_mm = size
      if units == "cm":
          width_mm *= 10
  
      anchor_size_bar = AnchoredSizeBar(
          axis.transData,
          width_mm,
          f"{size:g}{units}",
          fontproperties=fontproperties,
          frameon=frameon,
          loc=loc,
          pad=pad,
          borderpad=borderpad,
          sep=sep,
          size_vertical=size_vertical,
          label_top=label_top,
          color=color,
          **kwargs,
      )
  
      if frameon:
          anchor_size_bar.patch.set_facecolor(bg_color)
          anchor_size_bar.patch.set_edgecolor("none")
      axis.add_artist(anchor_size_bar)
  
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 7 for calling the BaseAxes obj's underlying member method code with example usage: obj.draw_scale_bar(bg_color, size, units, fontproperties, frameon, loc, pad, borderpad, sep, size_vertical, label_top, color, fontsize) without return types