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 setup_data(self, data: pd.DataFrame) -> pd.DataFrame:
      parse = self.params["parse"]
      fmt = self.params["format_string"]
  
      def _format(series: pd.Series, tpl: str) -> list[str | None]:
          """
          Format items in series
  
          Missing values are preserved as None
          """
          if series.dtype == "float":
              return [
                  None if np.isnan(l) else tpl.format(l) for l in series
              ]
          else:
              return [
                  None if l is None else tpl.format(l) for l in series
              ]
  
      # format
      if fmt:
          data["label"] = _format(data["label"], fmt)
  
      # Parse latex
      if parse:
          data["label"] = _format(data["label"], "${}$")
  
      return data
  
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 2 for calling the geom_text obj's underlying member method code with example usage: obj.setup_data(data) and returns: data, unknown, unknown