class_docstr: Violin Plot
  
  {usage}
  
  Parameters
  ----------
  {common_parameters}
  draw_quantiles : float | list[float], default=None
      draw horizontal lines at the given quantiles (0..1)
      of the density estimate.
  style : str, default="full"
      The type of violin plot to draw. The options are:
  
      ```python
      'full'        # Regular (2 sided violins)
      'left'        # Left-sided half violins
      'right'       # Right-sided half violins
      'left-right'  # Alternate (left first) half violins by the group
      'right-left'  # Alternate (right first) half violins by the group
      ```
class_docstr_tok: ["Violin","Plot","{","usage","}","Parameters","--","--","--","--","--","{","common_parameters","}","draw_quantiles",":","float","|","list","[","float","]",",","default=None","draw","horizontal","lines","at","the","given","quantiles","(","0","..","1",")","of","the","density","estimate",".","style",":","str",",","default=","''","full","''","The","type","of","violin","plot","to","draw",".","The","options","are",":","``","`","python","'full","'","#","Regular","(","2","sided","violins",")","'left","'","#","Left-sided","half","violins","'right","'","#","Right-sided","half","violins","'left-right","'","#","Alternate","(","left","first",")","half","violins","by","the","group","'right-left","'","#","Alternate","(","right","first",")","half","violins","by","the","group","``","`"]
code: def draw_panel(
      self,
      data: pd.DataFrame,
      panel_params: panel_view,
      coord: Coord,
      ax: Axes,
      **params: Any,
  ):
      quantiles = params["draw_quantiles"]
      style = params["style"]
  
      for i, (_, df) in enumerate(data.groupby("group")):
          # Find the points for the line to go all the way around
          df["xminv"] = df["x"] - df["violinwidth"] * (
              df["x"] - df["xmin"]
          )
          df["xmaxv"] = df["x"] + df["violinwidth"] * (
              df["xmax"] - df["x"]
          )
          even = i % 2 == 0
          if (
              style == "left"
              or (style == "left-right" and even)
              or (style == "right-left" and not even)
          ):
              df["xmaxv"] = df["x"]
          elif (
              style == "right"
              or (style == "right-left" and even)
              or (style == "left-right" and not even)
          ):
              df["xminv"] = df["x"]
  
          # Make sure it's sorted properly to draw the outline
          # i.e violin = kde + mirror kde,
          # bottom to top then top to bottom
          n = len(df)
          polygon_df = pd.concat(
              [
                  df.sort_values("y"),
                  df.sort_values("y", ascending=False),
              ],
              axis=0,
              ignore_index=True,
          )
  
          _df = polygon_df.iloc
          _loc = polygon_df.columns.get_loc
          _df[:n, _loc("x")] = _df[:n, _loc("xminv")]
          _df[n:, _loc("x")] = _df[n:, _loc("xmaxv")]
  
          # Close the polygon: set first and last point the same
          polygon_df.loc[-1, :] = polygon_df.loc[0, :]
  
          # plot violin polygon
          geom_polygon.draw_group(
              polygon_df, panel_params, coord, ax, **params
          )
  
          if quantiles is not None:
              # Get dataframe with quantile segments and that
              # with aesthetics then put them together
              # Each quantile segment is defined by 2 points and
              # they all get similar aesthetics
              aes_df = df.drop(["x", "y", "group"], axis=1)
              aes_df.reset_index(inplace=True)
              idx = [0] * 2 * len(quantiles)
              aes_df = aes_df.iloc[idx, :].reset_index(drop=True)
              segment_df = pd.concat(
                  [make_quantile_df(df, quantiles), aes_df], axis=1
              )
  
              # plot quantile segments
              geom_path.draw_group(
                  segment_df, panel_params, coord, ax, **params
              )
  
file_path: plotnine/plotnine/geoms/geom_violin.py
imports: from __future__ import annotations
  import typing
  import numpy
  import pandas
  from .._utils import groupby_apply, interleave, resolution
  from ..doctools import document
  from .geom import geom
  from .geom_path import geom_path
  from .geom_polygon import geom_polygon
label_desc: Use image node_id 3 for calling the geom_violin obj's underlying member method code with example usage: obj.draw_panel(data, panel_params, coord, ax) without return types