class_docstr: This class connects a :class:`ColorbarBase` to a
  :class:`~matplotlib.cm.ScalarMappable` such as a
  :class:`~matplotlib.image.AxesImage` generated via
  :meth:`~matplotlib.axes.Axes.imshow`.
  
  It is not intended to be instantiated directly; instead,
  use :meth:`~matplotlib.figure.Figure.colorbar` or
  :func:`~matplotlib.pyplot.colorbar` to make your colorbar.
class_docstr_tok: ["This","class","connects","a",":","class",":","`","ColorbarBase","`","to","a",":","class",":","`","~matplotlib.cm.ScalarMappable","`","such","as","a",":","class",":","`","~matplotlib.image.AxesImage","`","generated","via",":","meth",":","`","~matplotlib.axes.Axes.imshow","`",".","It","is","not","intended","to","be","instantiated","directly",";","instead",",","use",":","meth",":","`","~matplotlib.figure.Figure.colorbar","`","or",":","func",":","`","~matplotlib.pyplot.colorbar","`","to","make","your","colorbar","."]
docstr: Remove this colorbar from the figure.  If the colorbar was created with
  ``use_gridspec=True`` then restore the gridspec to its previous value.
docstr_tok: ["Remove","this","colorbar","from","the","figure",".","If","the","colorbar","was","created","with","``","use_gridspec=True","``","then","restore","the","gridspec","to","its","previous","value","."]
code: def remove(self):
      """
      Remove this colorbar from the figure.  If the colorbar was created with
      ``use_gridspec=True`` then restore the gridspec to its previous value.
      """
  
      ColorbarBase.remove(self)
      self.mappable.callbacksSM.disconnect(self.mappable.colorbar_cid)
      self.mappable.colorbar = None
      self.mappable.colorbar_cid = None
  
      try:
          ax = self.mappable.axes
      except AttributeError:
          return
  
      try:
          gs = ax.get_subplotspec().get_gridspec()
          subplotspec = gs.get_topmost_subplotspec()
      except AttributeError:
          # use_gridspec was False
          pos = ax.get_position(original=True)
          ax._set_position(pos)
      else:
          # use_gridspec was True
          ax.set_subplotspec(subplotspec)
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import six
  from six.moves import xrange, zip
  import warnings
  import numpy
  import matplotlib
  import matplotlib.artist
  import matplotlib.cbook
  import matplotlib.collections
  import matplotlib.colors
  import matplotlib.contour
  import matplotlib.cm
  import matplotlib.gridspec
  import matplotlib.patches
  import matplotlib.path
  import matplotlib.ticker
  import matplotlib.transforms
  import matplotlib._layoutbox
  import matplotlib._constrained_layout
  from matplotlib import docstring
label_desc: Use image node_id 6 for calling the Colorbar obj's underlying member method code with example usage: obj.remove() without return types