class_docstr: Compute Sina plot values
  
  {usage}
  
  Parameters
  ----------
  {common_parameters}
  binwidth : float, default=None
      The width of the bins. The default is to use bins that
      cover the range of the data. You should always override this
      value, exploring multiple widths to find the best to
      illustrate the stories in your data.
  bins : int, default=50
      Number of bins. Overridden by binwidth.
  method : Literal["density", "counts"], default="density"
      Choose the method to spread the samples within the same bin
      along the x-axis. Available methods: "density", "counts"
      (can be abbreviated, e.g. "d"). See Details.
  maxwidth : float, default=None
      Control the maximum width the points can spread into.
      Values should be in the range (0, 1).
  adjust : float, default=1
      Adjusts the bandwidth of the density kernel when
      `method="density"`. see [](`~plotnine.stats.stat_density`).
  bw : str | float, default="nrd0"
      The bandwidth to use, If a float is given, it is the bandwidth.
      The `str`{.py} choices are:
      `"nrd0", "normal_reference", "scott", "silverman"`{.py}
  
      `nrd0` is a port of `stats::bw.nrd0` in R; it is eqiuvalent
      to `silverman` when there is more than 1 value in a group.
  bin_limit : int, default=1
      If the samples within the same y-axis bin are more
      than `bin_limit`, the samples's X coordinates will be adjusted.
      This parameter is effective only when `method='counts'`{.py}
  random_state : int | ~numpy.random.RandomState, default=None
      Seed or Random number generator to use. If `None`, then
      numpy global generator :class:`numpy.random` is used.
  scale : Literal["area", "count", "width"], default="area"
      How to scale the sina groups.
  
      - `area` - Scale by the largest density/bin among the different sinas
      - `count` - areas are scaled proportionally to the number of points
      - `width` - Only scale according to the maxwidth parameter.
  
  See Also
  --------
  plotnine.geoms.geom_sina
code: def compute_panel(cls, data, scales, **params):
      maxwidth = params["maxwidth"]
      random_state = params["random_state"]
      fuzz = 1e-8
      y_dim = scales.y.dimension()
      y_dim_fuzzed = (y_dim[0] - fuzz, y_dim[1] + fuzz)
  
      if params["binwidth"] is not None:
          params["bins"] = breaks_from_binwidth(
              y_dim_fuzzed, params["binwidth"]
          )
      else:
          params["bins"] = breaks_from_bins(
              y_dim_fuzzed, params["bins"]
          )
  
      data = super(cls, stat_sina).compute_panel(data, scales, **params)
  
      if not len(data):
          return data
  
      if params["scale"] == "area":
          data["sinawidth"] = data["density"] / data["density"].max()
      elif params["scale"] == "count":
          data["sinawidth"] = (
              data["density"]
              / data["density"].max()
              * data["n"]
              / data["n"].max()
          )
      elif params["scale"] == "width":
          data["sinawidth"] = data["scaled"]
      else:
          msg = "Unknown scale value '{}'"
          raise PlotnineError(msg.format(params["scale"]))
  
      is_infinite = ~np.isfinite(data["sinawidth"])
      if is_infinite.any():
          data.loc[is_infinite, "sinawidth"] = 0
  
      data["xmin"] = data["x"] - maxwidth / 2
      data["xmax"] = data["x"] + maxwidth / 2
      data["x_diff"] = (
          random_state.uniform(-1, 1, len(data))
          * maxwidth
          * data["sinawidth"]
          / 2
      )
      data["width"] = maxwidth
  
      # jitter y values if the input is integer,
      # but not if it is the same value
      y = data["y"].to_numpy()
      all_integers = (y == np.floor(y)).all()
      some_are_unique = len(np.unique(y)) > 1
      if all_integers and some_are_unique:
          data["y"] = jitter(y, random_state=random_state)
  
      return data
  
file_path: plotnine/plotnine/stats/stat_sina.py
imports: import numpy
  import pandas
  from .._utils import array_kind, jitter, resolution
  from ..doctools import document
  from ..exceptions import PlotnineError
  from ..mapping.aes import has_groups
  from .binning import breaks_from_bins, breaks_from_binwidth
  from .stat import stat
  from .stat_density import compute_density
label_desc: Use image node_id 3 for calling the stat_sina obj's underlying member method code with example usage: obj.compute_panel(cls, data, scales) and returns: data, data