class_docstr: Place a legend on the figure/axes.
class_docstr_tok: ["Place","a","legend","on","the","figure\/axes","."]
docstr: Set the bbox that the legend will be anchored to.
  
  Parameters
  ----------
  bbox : `~matplotlib.transforms.BboxBase` or tuple
      The bounding box can be specified in the following ways:
  
      - A `.BboxBase` instance
      - A tuple of ``(left, bottom, width, height)`` in the given
        transform (normalized axes coordinate if None)
      - A tuple of ``(left, bottom)`` where the width and height will be
        assumed to be zero.
      - *None*, to remove the bbox anchoring, and use the parent bbox.
  
  transform : `~matplotlib.transforms.Transform`, optional
      A transform to apply to the bounding box. If not specified, this
      will use a transform to the bounding box of the parent.
docstr_tok: ["Set","the","bbox","that","the","legend","will","be","anchored","to",".","Parameters","--","--","--","--","--","bbox",":","`","~matplotlib.transforms.BboxBase","`","or","tuple","The","bounding","box","can","be","specified","in","the","following","ways",":","-","A","`",".BboxBase","`","instance","-","A","tuple","of","``","(","left",",","bottom",",","width",",","height",")","``","in","the","given","transform","(","normalized","axes","coordinate","if","None",")","-","A","tuple","of","``","(","left",",","bottom",")","``","where","the","width","and","height","will","be","assumed","to","be","zero",".","-","*","None","*",",","to","remove","the","bbox","anchoring",",","and","use","the","parent","bbox",".","transform",":","`","~matplotlib.transforms.Transform","`",",","optional","A","transform","to","apply","to","the","bounding","box",".","If","not","specified",",","this","will","use","a","transform","to","the","bounding","box","of","the","parent","."]
code: def set_bbox_to_anchor(self, bbox, transform=None):
      """
      Set the bbox that the legend will be anchored to.
  
      Parameters
      ----------
      bbox : `~matplotlib.transforms.BboxBase` or tuple
          The bounding box can be specified in the following ways:
  
          - A `.BboxBase` instance
          - A tuple of ``(left, bottom, width, height)`` in the given
            transform (normalized axes coordinate if None)
          - A tuple of ``(left, bottom)`` where the width and height will be
            assumed to be zero.
          - *None*, to remove the bbox anchoring, and use the parent bbox.
  
      transform : `~matplotlib.transforms.Transform`, optional
          A transform to apply to the bounding box. If not specified, this
          will use a transform to the bounding box of the parent.
      """
      if bbox is None:
          self._bbox_to_anchor = None
          return
      elif isinstance(bbox, BboxBase):
          self._bbox_to_anchor = bbox
      else:
          try:
              l = len(bbox)
          except TypeError as err:
              raise ValueError(f"Invalid bbox: {bbox}") from err
  
          if l == 2:
              bbox = [bbox[0], bbox[1], 0, 0]
  
          self._bbox_to_anchor = Bbox.from_bounds(*bbox)
  
      if transform is None:
          transform = BboxTransformTo(self.parent.bbox)
  
      self._bbox_to_anchor = TransformedBbox(
          self._bbox_to_anchor, transform
      )
      self.stale = True
  
imports: import itertools
  import logging
  import numbers
  import time
  import numpy
  import matplotlib
  from matplotlib import _api, _docstring, cbook, colors, offsetbox
  from matplotlib.artist import Artist, allow_rasterization
  from matplotlib.cbook import silent_list
  from matplotlib.font_manager import FontProperties
  from matplotlib.lines import Line2D
  from matplotlib.patches import Patch, Rectangle, Shadow, FancyBboxPatch, StepPatch
  from matplotlib.collections import Collection, CircleCollection, LineCollection, PathCollection, PolyCollection, RegularPolyCollection
  from matplotlib.text import Text
  from matplotlib.transforms import Bbox, BboxBase, TransformedBbox
  from matplotlib.transforms import BboxTransformTo, BboxTransformFrom
  from matplotlib.offsetbox import AnchoredOffsetbox, DraggableOffsetBox, HPacker, VPacker, DrawingArea, TextArea
  from matplotlib.container import ErrorbarContainer, BarContainer, StemContainer
  from .None import legend_handler
label_desc: Use image node_id 31 for calling the Legend obj's underlying member method code with example usage: obj.set_bbox_to_anchor(bbox, transform) without return types