class_docstr: Base class for all positions
docstr: Compute position for the layer in all panels
  
  Positions can override this function instead of
  `compute_panel` if the position computations are
  independent of the panel. i.e when not colliding
docstr_tok: ["Compute","position","for","the","layer","in","all","panels","Positions","can","override","this","function","instead","of","`","compute_panel","`","if","the","position","computations","are","independent","of","the","panel",".","i.e","when","not","colliding"]
code: def compute_layer(
      cls, data: pd.DataFrame, params: dict[str, Any], layout: Layout
  ):
      """
      Compute position for the layer in all panels
  
      Positions can override this function instead of
      `compute_panel` if the position computations are
      independent of the panel. i.e when not colliding
      """
  
      def fn(pdata: pd.DataFrame) -> pd.DataFrame:
          """
          Compute function helper
          """
          # Given data belonging to a specific panel, grab
          # the corresponding scales and call the method
          # that does the real computation
          if len(pdata) == 0:
              return pdata
          scales = layout.get_scales(pdata["PANEL"].iloc[0])
          return cls.compute_panel(pdata, scales, params)
  
      return groupby_apply(data, "PANEL", fn)
  
imports: from __future__ import annotations
  import typing
  from abc import ABC
  from copy import copy
  from warnings import warn
  import numpy
  from .._utils import check_required_aesthetics, groupby_apply
  from .._utils.registry import Register, Registry
  from ..exceptions import PlotnineError, PlotnineWarning
  from ..mapping.aes import X_AESTHETICS, Y_AESTHETICS
label_desc: Use image node_id 4 for calling the position obj's underlying member method code with example usage: obj.compute_layer(cls, data, params, layout) and returns: groupby_apply, cls, pdata