class_docstr: Draw a colorbar in an existing axes.
  
  This is a base class for the :class:`Colorbar` class, which is the
  basis for the :func:`~matplotlib.pyplot.colorbar` method and pylab
  function.
  
  It is also useful by itself for showing a colormap.  If the *cmap*
  kwarg is given but *boundaries* and *values* are left as None,
  then the colormap will be displayed on a 0-1 scale. To show the
  under- and over-value colors, specify the *norm* as::
  
      colors.Normalize(clip=False)
  
  To show the colors versus index instead of on the 0-1 scale,
  use::
  
      norm=colors.NoNorm.
  
  Useful attributes:
  
      :attr:`ax`
          the Axes instance in which the colorbar is drawn
  
      :attr:`lines`
          a LineCollection if lines were drawn, otherwise None
  
      :attr:`dividers`
          a LineCollection if *drawedges* is True, otherwise None
  
  Useful public methods are :meth:`set_label` and :meth:`add_lines`.
class_docstr_tok: ["Draw","a","colorbar","in","an","existing","axes",".","This","is","a","base","class","for","the",":","class",":","`","Colorbar","`","class",",","which","is","the","basis","for","the",":","func",":","`","~matplotlib.pyplot.colorbar","`","method","and","pylab","function",".","It","is","also","useful","by","itself","for","showing","a","colormap",".","If","the","*","cmap","*","kwarg","is","given","but","*","boundaries","*","and","*","values","*","are","left","as","None",",","then","the","colormap","will","be","displayed","on","a","0-1","scale",".","To","show","the","under-","and","over-value","colors",",","specify","the","*","norm","*","as",":",":","colors.Normalize","(","clip=False",")","To","show","the","colors","versus","index","instead","of","on","the","0-1","scale",",","use",":",":","norm=colors.NoNorm",".","Useful","attributes",":",":","attr",":","`","ax","`","the","Axes","instance","in","which","the","colorbar","is","drawn",":","attr",":","`","lines","`","a","LineCollection","if","lines","were","drawn",",","otherwise","None",":","attr",":","`","dividers","`","a","LineCollection","if","*","drawedges","*","is","True",",","otherwise","None","Useful","public","methods","are",":","meth",":","`","set_label","`","and",":","meth",":","`","add_lines","`","."]
code: def __init__(
      self,
      ax,
      cmap=None,
      norm=None,
      alpha=1.0,
      values=None,
      boundaries=None,
      orientation="vertical",
      extend="neither",
      spacing="uniform",  # uniform or proportional
      ticks=None,
      format=None,
      drawedges=False,
      filled=True,
  ):
      self.ax = ax
  
      if cmap is None:
          cmap = cm.get_cmap()
      if norm is None:
          norm = colors.Normalize()
      self.alpha = alpha
      cm.ScalarMappable.__init__(self, cmap=cmap, norm=norm)
      self.values = values
      self.boundaries = boundaries
      self.extend = extend
      self.spacing = spacing
      self.orientation = orientation
      self.drawedges = drawedges
      self.filled = filled
  
      # artists
      self.solids = None
      self.lines = None
      self.dividers = None
      self.extension_patch1 = None
      self.extension_patch2 = None
  
      if orientation == "vertical":
          self.cbar_axis = self.ax.yaxis
      else:
          self.cbar_axis = self.ax.xaxis
  
      if format is None:
          if isinstance(self.norm, colors.LogNorm):
              # change both axis for proper aspect
              self.ax.set_xscale("log")
              self.ax.set_yscale("log")
              self.cbar_axis.set_minor_locator(ticker.NullLocator())
              formatter = ticker.LogFormatter()
          else:
              formatter = None
      elif isinstance(format, six.string_types):
          formatter = ticker.FormatStrFormatter(format)
      else:
          formatter = format  # Assume it is a Formatter
  
      if formatter is None:
          formatter = self.cbar_axis.get_major_formatter()
      else:
          self.cbar_axis.set_major_formatter(formatter)
  
      if cbook.iterable(ticks):
          self.cbar_axis.set_ticks(ticks)
      elif ticks is not None:
          self.cbar_axis.set_major_locator(ticks)
      else:
          self._select_locator(formatter)
  
      self._config_axes()
  
      self.update_artists()
  
      self.set_label_text("")
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import six
  from six.moves import xrange, zip
  import numpy
  import matplotlib
  import matplotlib.colors
  import matplotlib.cm
  from matplotlib import docstring
  import matplotlib.ticker
  import matplotlib.cbook
  import matplotlib.collections
  import matplotlib.contour
  from matplotlib.path import Path
  from matplotlib.patches import PathPatch
  from matplotlib.transforms import Bbox
label_desc: Use image node_id 1 to create a new ColorbarBase object from inherited base classes: cm with example: obj = ColorbarBase(ax, cmap, norm, alpha, values, boundaries, orientation, extend, spacing, ticks, format, drawedges, filled)