class_docstr: Binning for a dot plot
  
  {usage}
  
  Parameters
  ----------
  {common_parameters}
  bins : int, default=None
      Number of bins. Overridden by binwidth. If `None`{.py},
      a number is computed using the freedman-diaconis method.
  binwidth : float, default=None
      When `method='dotdensity'`{.py}, this specifies the maximum
      binwidth. When `method='histodot'`{.py}, this specifies the
      binwidth. This supercedes the `bins`.
  origin : float, default=None
      When `method='histodot'`{.py}, origin of the first bin.
  width : float, default=0.9
      When `binaxis='y'`{.py}, the spacing of the dotstacks for
      dodging.
  binaxis : Literal["x", "y"], default="x"
      Axis to bin along.
  method : Literal["dotdensity", "histodot"], default="dotdensity"
      Whether to do dot-density binning or fixed widths binning.
  binpositions : Literal["all", "bygroup"], default="bygroup"
      Position of the bins when `method="dotdensity"`{.py}. The value
      - `bygroup` -  positions of the bins for each group are
      determined separately.
      - `all` - positions of the bins are determined with all
      data taken together. This aligns the dots
      stacks across multiple groups.
  drop : bool, default=False
      If `True`{.py}, remove all bins with zero counts.
  right : bool, default=True
      When `method='histodot'`{.py}, :py:`True` means include right
      edge of the bins and if `False`{.py} the left edge is included.
  breaks : FloatArray, default=None
      Bin boundaries for `method='histodot'`{.py}. This supercedes the
      `binwidth` and `bins`.
  
  See Also
  --------
  plotnine.stats.stat_bin
class_docstr_tok: ["Binning","for","a","dot","plot","{","usage","}","Parameters","--","--","--","--","--","{","common_parameters","}","bins",":","int",",","default=None","Number","of","bins",".","Overridden","by","binwidth",".","If","`","None","`","{",".py","}",",","a","number","is","computed","using","the","freedman-diaconis","method",".","binwidth",":","float",",","default=None","When","`","method='dotdensity","'","`","{",".py","}",",","this","specifies","the","maximum","binwidth",".","When","`","method='histodot","'","`","{",".py","}",",","this","specifies","the","binwidth",".","This","supercedes","the","`","bins","`",".","origin",":","float",",","default=None","When","`","method='histodot","'","`","{",".py","}",",","origin","of","the","first","bin",".","width",":","float",",","default=0.9","When","`","binaxis=","'","y","'","`","{",".py","}",",","the","spacing","of","the","dotstacks","for","dodging",".","binaxis",":","Literal","[","``","x","''",",","``","y","''","]",",","default=","''","x","''","Axis","to","bin","along",".","method",":","Literal","[","``","dotdensity","''",",","``","histodot","''","]",",","default=","''","dotdensity","''","Whether","to","do","dot-density","binning","or","fixed","widths","binning",".","binpositions",":","Literal","[","``","all","''",",","``","bygroup","''","]",",","default=","''","bygroup","''","Position","of","the","bins","when","`","method=","''","dotdensity","''","`","{",".py","}",".","The","value","-","`","bygroup","`","-","positions","of","the","bins","for","each","group","are","determined","separately",".","-","`","all","`","-","positions","of","the","bins","are","determined","with","all","data","taken","together",".","This","aligns","the","dots","stacks","across","multiple","groups",".","drop",":","bool",",","default=False","If","`","True","`","{",".py","}",",","remove","all","bins","with","zero","counts",".","right",":","bool",",","default=True","When","`","method='histodot","'","`","{",".py","}",",",":","py",":","`","True","`","means","include","right","edge","of","the","bins","and","if","`","False","`","{",".py","}","the","left","edge","is","included",".","breaks",":","FloatArray",",","default=None","Bin","boundaries","for","`","method='histodot","'","`","{",".py","}",".","This","supercedes","the","`","binwidth","`","and","`","bins","`",".","See","Also","--","--","--","--","plotnine.stats.stat_bin"]
code: def compute_panel(cls, data, scales, **params):
      if (
          params["method"] == "dotdensity"
          and params["binpositions"] == "all"
      ):
          binaxis = params["binaxis"]
          weight: pd.Series | None = data.get(
              "weight"
          )  # pyright: ignore
          if binaxis == "x":
              newdata = densitybin(
                  x=data["x"],
                  weight=weight,
                  binwidth=params["binwidth"],
                  bins=params["bins"],
              )
              data = data.sort_values("x")
              data.reset_index(inplace=True, drop=True)
              newdata = newdata.sort_values("x")
              newdata.reset_index(inplace=True, drop=True)
          elif binaxis == "y":
              newdata = densitybin(
                  x=data["y"],
                  weight=weight,
                  binwidth=params["binwidth"],
                  bins=params["bins"],
              )
              data = data.sort_values("y")
              data.reset_index(inplace=True, drop=True)
              newdata = newdata.sort_values("x")
              newdata.reset_index(inplace=True, drop=True)
          else:
              raise ValueError(f"Unknown value {binaxis=}")
  
          data["bin"] = newdata["bin"]
          data["binwidth"] = newdata["binwidth"]
          data["weight"] = newdata["weight"]
          data["bincenter"] = newdata["bincenter"]
      return super(cls, stat_bindot).compute_panel(
          data, scales, **params
      )
  
file_path: plotnine/plotnine/stats/stat_bindot.py
imports: from __future__ import annotations
  import typing
  from warnings import warn
  import numpy
  import pandas
  from .._utils import groupby_apply
  from ..doctools import document
  from ..exceptions import PlotnineError, PlotnineWarning
  from ..mapping.evaluation import after_stat
  from .binning import assign_bins, breaks_from_bins, breaks_from_binwidth, freedman_diaconis_bins
  from .stat import stat
label_desc: Use image node_id 2 for calling the stat_bindot obj's underlying member method code with example usage: obj.compute_panel(cls, data, scales) and returns: super