GeomViolin

Violin geometry: mirrored kernel density of continuous y at each discrete x (stat ydensity). One polygon per x×group. Default position dodge.

Defaults

geom
violin
default stat
ydensity
default position
dodge
params type
ViolinParams

Svelte component

import { GGPlot, GeomViolin } from "@ggsvelte/svelte";

<GGPlot data={rows} aes={{ x: "x", y: "y" }}>
  <GeomViolin />
</GGPlot>

JSON layer

{
  "geom": "violin",
  "stat": "ydensity"
}

Params

bw

number

Kernel bandwidth in data units (must be greater than 0). Omit for R's bw.nrd0 rule-of-thumb default.

adjust

number

Bandwidth multiplier (must be greater than 0). Default 1.

n

number

Number of density grid points (2–4096). Default 512.

trim

boolean

When true (default), trim the density to the data range; when false, extend cut·bw tails like density().

scale

"area" | "count" | "width"

Relative violin max-width scaling: "area" (default), "count", or "width" (equal max width).

width

number

Max violin width as a fraction of the discrete x band (like boxplot). Default 0.75.

alpha

number

Fill opacity. Must be between 0 and 1 (inclusive). Default 1.

linewidth

number

Outline stroke width in px. Must be greater than 0. Default 0.5.

fillPaint

GradientPaint

Within-mark gradient fill paint (not a data scale). Requires a solid fallback.

strokePaint

GradientPaint

Within-mark gradient stroke paint (not a data scale). Requires a solid fallback.

glow

GlowSpec

Bounded within-mark glow treatment (not theme decoration).

Allowed stats

Allowed positions

Examples

← All geoms · Getting started