code: def violinplot(vals, fillcolor="#1f77b4", rugplot=True):
      """
      Refer to FigureFactory.create_violin() for docstring.
      """
      vals = np.asarray(vals, float)
      #  summary statistics
      vals_min = calc_stats(vals)["min"]
      vals_max = calc_stats(vals)["max"]
      q1 = calc_stats(vals)["q1"]
      q2 = calc_stats(vals)["q2"]
      q3 = calc_stats(vals)["q3"]
      d1 = calc_stats(vals)["d1"]
      d2 = calc_stats(vals)["d2"]
  
      # kernel density estimation of pdf
      pdf = scipy_stats.gaussian_kde(vals)
      # grid over the data interval
      xx = np.linspace(vals_min, vals_max, 100)
      # evaluate the pdf at the grid xx
      yy = pdf(xx)
      max_pdf = np.max(yy)
      # distance from the violin plot to rugplot
      distance = (2.0 * max_pdf) / 10 if rugplot else 0
      # range for x values in the plot
      plot_xrange = [-max_pdf - distance - 0.1, max_pdf + 0.1]
      plot_data = [
          make_half_violin(-yy, xx, fillcolor=fillcolor),
          make_half_violin(yy, xx, fillcolor=fillcolor),
          make_non_outlier_interval(d1, d2),
          make_quartiles(q1, q3),
          make_median(q2),
      ]
      if rugplot:
          plot_data.append(
              make_violin_rugplot(
                  vals, max_pdf, distance=distance, color=fillcolor
              )
          )
      return plot_data, plot_xrange
  
file_path: plotly.py/packages/python/plotly/plotly/figure_factory/_violin.py
imports: from numbers import Number
  from plotly import exceptions, optional_imports
  import plotly.colors
  from plotly.graph_objs import graph_objs
  from plotly.subplots import make_subplots
label_desc: Use image node_id 9 for calling a global function with example usage: violinplot(vals, fillcolor, rugplot) and returns: plot_data,  plot_xrange