class_docstr: Superimpose a function onto a plot
  
  {usage}
  
  Parameters
  ----------
  {common_parameters}
  fun : callable
      Function to evaluate.
  n : int, default=101
      Number of points at which to evaluate the function.
  xlim : tuple, default=None
      `x` limits for the range. The default depends on
      the `x` aesthetic. There is not an `x` aesthetic
      then the `xlim` must be provided.
  args : Optional[tuple[Any] | dict[str, Any]], default=None
      Arguments to pass to `fun`.
code: def compute_group(cls, data, scales, **params):
      old_fun: Callable[..., FloatArrayLike] = params["fun"]
      n = params["n"]
      args = params["args"]
      xlim = params["xlim"]
      range_x = xlim or scales.x.dimension((0, 0))
  
      if isinstance(args, (list, tuple)):
  
          def fun(x):
              return old_fun(x, *args)
  
      elif isinstance(args, dict):
  
          def fun(x):
              return old_fun(x, **args)
  
      elif args is not None:
  
          def fun(x):
              return old_fun(x, args)
  
      else:
  
          def fun(x):
              return old_fun(x)
  
      x = np.linspace(range_x[0], range_x[1], n)
  
      # continuous scale
      if isinstance(scales.x, scale_continuous):
          x = scales.x.trans.inverse(x)
  
      # We know these can handle array_likes
      if isinstance(old_fun, (np.ufunc, np.vectorize)):
          fx = fun(x)
      else:
          fx = [fun(val) for val in x]
  
      new_data = pd.DataFrame({"x": x, "fx": fx})
      return new_data
  
file_path: plotnine/plotnine/stats/stat_function.py
imports: from __future__ import annotations
  import typing
  import numpy
  import pandas
  from ..doctools import document
  from ..exceptions import PlotnineError
  from ..mapping.evaluation import after_stat
  from ..scales.scale_continuous import scale_continuous
  from .stat import stat
label_desc: Use image node_id 3 for calling the stat_function obj's underlying member method code with example usage: obj.compute_group(cls, data, scales) and returns: new_data, old_fun, old_fun, old_fun, old_fun