class_docstr: Base class of all Geoms
class_docstr_tok: ["Base","class","of","all","Geoms"]
docstr: Combine data with defaults and set aesthetics from parameters
  
  geoms should not override this method.
  
  Parameters
  ----------
  data :
      Data used for drawing the geom.
  aes_modifiers :
      Aesthetics
  
  Returns
  -------
  :
      Data used for drawing the geom.
docstr_tok: ["Combine","data","with","defaults","and","set","aesthetics","from","parameters","geoms","should","not","override","this","method",".","Parameters","--","--","--","--","--","data",":","Data","used","for","drawing","the","geom",".","aes_modifiers",":","Aesthetics","Returns","--","--","--","-",":","Data","used","for","drawing","the","geom","."]
code: def use_defaults(
      self, data: pd.DataFrame, aes_modifiers: dict[str, Any]
  ) -> pd.DataFrame:
      """
      Combine data with defaults and set aesthetics from parameters
  
      geoms should not override this method.
  
      Parameters
      ----------
      data :
          Data used for drawing the geom.
      aes_modifiers :
          Aesthetics
  
      Returns
      -------
      :
          Data used for drawing the geom.
      """
      missing_aes = (
          self.DEFAULT_AES.keys()
          - self.aes_params.keys()
          - set(data.columns.to_list())
      )
  
      # Not in data and not set, use default
      for ae in missing_aes:
          data[ae] = self.DEFAULT_AES[ae]
  
      # Evaluate/Modify the mapped aesthetics
      evaled = evaluate(aes_modifiers, data, self.environment)
      for ae in evaled.columns.intersection(data.columns):
          data[ae] = evaled[ae]
  
      num_panels = len(data["PANEL"].unique()) if "PANEL" in data else 1
  
      # Aesthetics set as parameters to the geom/stat
      for ae, value in self.aes_params.items():
          try:
              data[ae] = value
          except ValueError as e:
              # sniff out the special cases, like custom
              # tupled linetypes, shapes and colors
              if is_valid_aesthetic(value, ae):
                  data[ae] = [value] * len(data)
              elif num_panels > 1 and is_list_like(value):
                  data[ae] = list(chain(*repeat(value, num_panels)))
              else:
                  msg = (
                      f"'{value}' does not look like a "
                      f"valid value for `{ae}`"
                  )
                  raise PlotnineError(msg) from e
  
      return data
  
imports: from __future__ import annotations
  import typing
  from abc import ABC
  from copy import deepcopy
  from itertools import chain, repeat
  from .._utils import copy_keys, data_mapping_as_kwargs, is_list_like, remove_missing
  from .._utils.registry import Register, Registry
  from ..exceptions import PlotnineError
  from ..layer import layer
  from ..mapping.aes import is_valid_aesthetic, rename_aesthetics
  from ..mapping.evaluation import evaluate
  from ..positions.position import position
  from ..stats.stat import stat
label_desc: Use image node_id 6 for calling the geom obj's underlying member method code with example usage: obj.use_defaults(data, aes_modifiers) and returns: data