class_docstr: Guides for each scale
  
  Used to assign a particular guide to an aesthetic(s).
  
  Parameters
  ----------
  kwargs : dict
      aesthetic - guide pairings. e.g
      ```python
      guides(color=guide_colorbar())
      ```
class_docstr_tok: ["Guides","for","each","scale","Used","to","assign","a","particular","guide","to","an","aesthetic","(","s",")",".","Parameters","--","--","--","--","--","kwargs",":","dict","aesthetic","-","guide","pairings",".","e.g","``","`","python","guides","(","color=guide_colorbar","(",")",")","``","`"]
docstr: Compute all the required guides
  
  Parameters
  ----------
  plot : ggplot
      ggplot object
  
  Returns
  -------
  gdefs : list
      Guides for the plots
docstr_tok: ["Compute","all","the","required","guides","Parameters","--","--","--","--","--","plot",":","ggplot","ggplot","object","Returns","--","--","--","-","gdefs",":","list","Guides","for","the","plots"]
code: def train(self, plot):
      """
      Compute all the required guides
  
      Parameters
      ----------
      plot : ggplot
          ggplot object
  
      Returns
      -------
      gdefs : list
          Guides for the plots
      """
      gdefs = []
  
      for scale in plot.scales:
          for output in scale.aesthetics:
              # The guide for aesthetic 'xxx' is stored
              # in plot.guides['xxx']. The priority for
              # the guides depends on how they are created
              # 1. ... + guides(xxx=guide_blah())
              # 2. ... + scale_xxx(guide=guide_blah())
              # 3. default(either guide_legend or guide_colorbar
              #            depending on the scale type)
              # output = scale.aesthetics[0]
              guide = self.get(output, scale.guide)
  
              if guide is None or guide is False:
                  continue
  
              # check the validity of guide.
              # if guide is character, then find the guide object
              guide = self.validate(guide)
              # check the consistency of the guide and scale.
              if (
                  "any" not in guide.available_aes
                  and scale.aesthetics[0] not in guide.available_aes
              ):
                  raise PlotnineError(
                      f"{guide.__class__.__name__} cannot be used for "
                      f"{scale.aesthetics}"
                  )
  
              # title
              if not hasattr(guide, "title"):
                  if scale.name:
                      guide.title = scale.name
                  else:
                      guide.title = getattr(plot.labels, output)
                      if guide.title is None:
                          warn(
                              f"Cannot generate legend for the {output!r} "
                              "aesthetic. Make sure you have mapped a "
                              "variable to it",
                              PlotnineWarning,
                          )
  
              # each guide object trains scale within the object,
              # so Guides (i.e., the container of guides)
              # need not to know about them
              guide = guide.train(scale, output)
  
              if guide is not None:
                  gdefs.append(guide)
  
      return gdefs
  
imports: from __future__ import annotations
  import typing
  from copy import deepcopy
  from warnings import warn
  import numpy
  import pandas
  from .._utils.registry import Registry
  from ..exceptions import PlotnineError, PlotnineWarning
  from .guide import guide
label_desc: Use image node_id 4 for calling the guides obj's underlying member method code with example usage: obj.train(plot) and returns: gdefs