class_docstr: Textual annotations
  
  {usage}
  
  Parameters
  ----------
  {common_parameters}
  parse : bool, default=False
      If `True`{.py}, the labels will be rendered with
      [latex](http://matplotlib.org/users/usetex.html).
  family : str, default=None
      Font family.
  fontweight : int | str, default="normal"
      Font weight.
  fontstyle : Literal["normal", "italic", "oblique"], default="normal"
      Font style.
  nudge_x : float, default=0
      Horizontal adjustment to apply to the text
  nudge_y : float, default=0
      Vertical adjustment to apply to the text
  adjust_text: dict, default=None
      Parameters to :class:`adjustText.adjust_text` will repel
      overlapping texts. This parameter takes priority of over
      `nudge_x` and `nudge_y`.
      `adjust_text` does not work well when it is used in the
      first layer of the plot, or if it is the only layer.
      For more see the documentation at
      https://github.com/Phlya/adjustText/wiki .
  format_string : str, default=None
      If not `None`{.py}, then the text is formatted with this
      string using :meth:`str.format` e.g:
  
      ```python
      # 2.348 -> "2.35%"
      geom_text(format_string="{:.2f}%")
      ```
  path_effects : list, default=None
      If not `None`{.py}, then the text will use these effects.
      See
      [](https://matplotlib.org/tutorials/advanced/patheffects_guide.html)
      documentation for more details.
  
  See Also
  --------
  plotnine.geoms.geom_label
  matplotlib.text.Text
  matplotlib.patheffects
class_docstr_tok: ["Textual","annotations","{","usage","}","Parameters","--","--","--","--","--","{","common_parameters","}","parse",":","bool",",","default=False","If","`","True","`","{",".py","}",",","the","labels","will","be","rendered","with","[","latex","]","(","http",":","\/\/matplotlib.org\/users\/usetex.html",")",".","family",":","str",",","default=None","Font","family",".","fontweight",":","int","|","str",",","default=","''","normal","''","Font","weight",".","fontstyle",":","Literal","[","``","normal","''",",","``","italic","''",",","``","oblique","''","]",",","default=","''","normal","''","Font","style",".","nudge_x",":","float",",","default=0","Horizontal","adjustment","to","apply","to","the","text","nudge_y",":","float",",","default=0","Vertical","adjustment","to","apply","to","the","text","adjust_text",":","dict",",","default=None","Parameters","to",":","class",":","`","adjustText.adjust_text","`","will","repel","overlapping","texts",".","This","parameter","takes","priority","of","over","`","nudge_x","`","and","`","nudge_y","`",".","`","adjust_text","`","does","not","work","well","when","it","is","used","in","the","first","layer","of","the","plot",",","or","if","it","is","the","only","layer",".","For","more","see","the","documentation","at","https",":","\/\/github.com\/Phlya\/adjustText\/wiki",".","format_string",":","str",",","default=None","If","not","`","None","`","{",".py","}",",","then","the","text","is","formatted","with","this","string","using",":","meth",":","`","str.format","`","e.g",":","``","`","python","#","2.348","-",">","``","2.35","%","''","geom_text","(","format_string=","''","{",":",".2f","}","%","''",")","``","`","path_effects",":","list",",","default=None","If","not","`","None","`","{",".py","}",",","then","the","text","will","use","these","effects",".","See","[","]","(","https",":","\/\/matplotlib.org\/tutorials\/advanced\/patheffects_guide.html",")","documentation","for","more","details",".","See","Also","--","--","--","--","plotnine.geoms.geom_label","matplotlib.text.Text","matplotlib.patheffects"]
code: def draw_group(
      data: pd.DataFrame,
      panel_params: panel_view,
      coord: Coord,
      ax: Axes,
      **params: Any,
  ):
      data = coord.transform(data, panel_params)
  
      # Bind color and alpha
      color = to_rgba(data["color"], data["alpha"])
  
      # Create a dataframe for the plotting data required
      # by ax.text
      plot_data = data[["x", "y", "size", "ha", "va"]].copy()
      plot_data["s"] = data["label"]
      plot_data["rotation"] = data["angle"]
      plot_data["linespacing"] = data["lineheight"]
      plot_data["color"] = color
      plot_data["family"] = params["family"]
      plot_data["fontweight"] = params["fontweight"]
      plot_data["fontstyle"] = params["fontstyle"]
      plot_data["zorder"] = params["zorder"]
      plot_data["rasterized"] = params["raster"]
      plot_data["clip_on"] = True
  
      # 'boxstyle' indicates geom_label so we need an MPL bbox
      draw_label = "boxstyle" in params
      if draw_label:
          fill = to_rgba(data.pop("fill"), data["alpha"])
          if isinstance(fill, tuple):
              fill = [list(fill)] * len(data["x"])
          plot_data["facecolor"] = fill
  
          if params["boxstyle"] in ("round", "round4"):
              boxstyle = (
                  f"{params['boxstyle']},"
                  f"pad={params['label_padding']},"
                  f"rounding_size={params['label_r']}"
              )
          elif params["boxstyle"] in ("roundtooth", "sawtooth"):
              boxstyle = (
                  f"{params['boxstyle']},"
                  f"pad={params['label_padding']},"
                  f"tooth_size={params['tooth_size']}"
              )
          else:
              boxstyle = (
                  f"{params['boxstyle']},"
                  f"pad={params['label_padding']},"
              )
          bbox = {
              "linewidth": params["label_size"],
              "boxstyle": boxstyle,
          }
      else:
          bbox = {}
  
      texts = []
  
      # For labels add a bbox
      for i in range(len(data)):
          kw: dict[str, Any] = plot_data.iloc[i].to_dict()
          if draw_label:
              kw["bbox"] = bbox
              kw["bbox"]["edgecolor"] = (
                  params["boxcolor"] or kw["color"]
              )
              kw["bbox"]["facecolor"] = kw.pop("facecolor")
          text_elem = ax.text(**kw)
          texts.append(text_elem)
          if params["path_effects"]:
              text_elem.set_path_effects(params["path_effects"])
  
      _adjust = params["adjust_text"]
      if _adjust:
          from adjustText import adjust_text
  
          if params["zorder"] == 1:
              warn(
                  "For better results with adjust_text, it should "
                  "not be the first layer or the only layer.",
                  PlotnineWarning,
              )
  
          arrowprops = _adjust.pop("arrowprops", {})
          if "color" not in arrowprops:
              arrowprops["color"] = color[0]
  
          adjust_text(texts, ax=ax, arrowprops=arrowprops, **_adjust)
  
file_path: plotnine/plotnine/geoms/geom_text.py
imports: from __future__ import annotations
  import typing
  from contextlib import suppress
  from warnings import warn
  import numpy
  from .._utils import order_as_data_mapping, to_rgba
  from ..doctools import document
  from ..exceptions import PlotnineError, PlotnineWarning
  from ..positions import position_nudge
  from .geom import geom
label_desc: Use image node_id 4 for calling the geom_text obj's underlying member method code with example usage: obj.draw_group(data, panel_params, coord, ax) without return types