class_docstr: Guide colorbar
  
  Parameters
  ----------
  barwidth : float, default=None
      Width (in pixels) of the colorbar. If `None`, the
      [](`~plotnine.themes.themeable.legend_key_width`) is
      used. The value is multiplied by `1.45`.
  barheight : float, default=None
      Height (in pixels) of the colorbar.
      [](`~plotnine.themes.themeable.legend_key_height`) is
      used. The value is multiplied by `5 * 1.45`.
  nbin : int, default=20
      Number of bins for drawing a colorbar. A larger value yields
      a smoother colorbar
  raster : bool, default=False
      Whether to render the colorbar as a raster object.
  ticks : bool, default=True
      Whether tick marks on colorbar should be visible.
  draw_ulim : bool, default=True
      Whether to show the upper limit tick marks.
  draw_llim : bool, default=True
      Whether to show the lower limit tick marks.
  direction : Literal["horizontal", "vertical"], default="horizontal"
      Direction of the guide.
  kwargs : dict
      Parameters passed on to :class:`.guide`
class_docstr_tok: ["Guide","colorbar","Parameters","--","--","--","--","--","barwidth",":","float",",","default=None","Width","(","in","pixels",")","of","the","colorbar",".","If","`","None","`",",","the","[","]","(","`","~plotnine.themes.themeable.legend_key_width","`",")","is","used",".","The","value","is","multiplied","by","`","1.45","`",".","barheight",":","float",",","default=None","Height","(","in","pixels",")","of","the","colorbar",".","[","]","(","`","~plotnine.themes.themeable.legend_key_height","`",")","is","used",".","The","value","is","multiplied","by","`","5","*","1.45","`",".","nbin",":","int",",","default=20","Number","of","bins","for","drawing","a","colorbar",".","A","larger","value","yields","a","smoother","colorbar","raster",":","bool",",","default=False","Whether","to","render","the","colorbar","as","a","raster","object",".","ticks",":","bool",",","default=True","Whether","tick","marks","on","colorbar","should","be","visible",".","draw_ulim",":","bool",",","default=True","Whether","to","show","the","upper","limit","tick","marks",".","draw_llim",":","bool",",","default=True","Whether","to","show","the","lower","limit","tick","marks",".","direction",":","Literal","[","``","horizontal","''",",","``","vertical","''","]",",","default=","''","horizontal","''","Direction","of","the","guide",".","kwargs",":","dict","Parameters","passed","on","to",":","class",":","`",".guide","`"]
code: def train(self, scale: scale, aesthetic=None):
      if not isinstance(scale, scale_continuous):
          warn(
              "colorbar guide needs continuous scales", PlotnineWarning
          )
          return None
  
      if aesthetic is None:
          aesthetic = scale.aesthetics[0]
  
      # Do nothing if scales are inappropriate
      if set(scale.aesthetics) & self.available_aes == 0:
          warn(
              "colorbar guide needs appropriate scales.",
              PlotnineWarning,
          )
          return None
  
      # value = breaks (numeric) is used for determining the
      # position of ticks
      limits = scale.limits
      breaks = scale.get_bounded_breaks()
  
      if not len(breaks):
          return None
  
      self.key = pd.DataFrame(
          {
              aesthetic: scale.map(breaks),
              "label": scale.get_labels(breaks),
              "value": breaks,
          }
      )
  
      bar = np.linspace(limits[0], limits[1], self.nbin)
      self.bar = pd.DataFrame({"color": scale.map(bar), "value": bar})
  
      labels = " ".join(str(x) for x in self.key["label"])
      info = "\n".join(
          [
              self.title,
              labels,
              " ".join(self.bar["color"].tolist()),
              self.__class__.__name__,
          ]
      )
      self.hash = hashlib.sha256(info.encode("utf-8")).hexdigest()
      return self
  
imports: from __future__ import annotations
  import hashlib
  import typing
  from warnings import warn
  import numpy
  import pandas
  from mizani.bounds import rescale
  from ..exceptions import PlotnineWarning
  from ..mapping.aes import rename_aesthetics
  from ..scales.scale_continuous import scale_continuous
  from .guide import guide
label_desc: Use image node_id 1 for calling the guide_colorbar obj's underlying member method code with example usage: obj.train(scale, aesthetic) and returns: self, None, None, None