HAHS.
Back to Catalog

Violin Plot

chart

Also known as: density plot, mirrored density, violin chart

Show distributionCompareShow deviation NumericalCategorical Bar/Column

설명 / Description

바이올린 플롯은 박스 플롯의 정보와 커널 밀도 추정(KDE)을 결합하여, 각 범주에 대해 대칭적이고 매끄러운 밀도 형태를 만듭니다. 값 축의 어느 지점에서든 "바이올린"의 너비는 그 값에서 데이터의 추정 확률 밀도를 나타냅니다. 넓은 부분은 데이터 포인트의 밀집도가 높음을, 좁은 부분은 성긴 영역을 나타냅니다. 이 형태는 박스 플롯이 감추는 특징들 — 다중 모드성, 비대칭, 두꺼운 꼬리, 분포의 공백 — 을 즉시 드러냅니다.

A violin plot combines the information of a box plot with a kernel density estimate (KDE), creating a mirrored, smoothed density shape for each category. The width of the "violin" at any point along the value axis represents the estimated probability density of data at that value. Wider sections indicate higher concentrations of data points, while narrow sections indicate sparse regions. This shape immediately reveals features that box plots conceal: bimodality, skewness, heavy tails, and gaps in the distribution.

각 바이올린은 일반적으로 대칭입니다(중심 축 양쪽으로 미러링됨), 다만 분할 바이올린은 하나의 바이올린 형태 안에 두 하위 그룹을 나란히 보여줄 수 있습니다. 많은 구현체가 바이올린 내부에 축소된 박스 플롯이나 개별 데이터 포인트를 겹쳐 표시하여, 밀도 정보와 함께 익숙한 사분위수 요약을 제공합니다.

Each violin is typically symmetric (mirrored on both sides of a central axis), though split violins can show two sub-groups side by side within a single violin shape. Many implementations overlay a miniature box plot or individual data points inside the violin to provide the familiar quartile summary alongside the density information.

바이올린 플롯은 형태가 중심과 산포만큼 중요한 범주 간 분포를 비교할 때 진가를 발휘합니다. 청중이 다섯 수치 요약이 아니라 분포에 관한 완전한 이야기를 이해해야 하는 과학적, 통계적 커뮤니케이션에서 특히 유용합니다.

Violin plots shine when comparing distributions across categories where shape matters as much as center and spread. They are particularly valuable in scientific and statistical communication where the audience needs to understand the full distributional story rather than just a five-number summary.

Violin Plot — interactive example

언제 사용하나 / When to Use

  • 중심과 산포뿐 아니라 여러 그룹 간 분포의 형태를 비교할 때
  • Comparing the shape of distributions across multiple groups, not just center and spread
  • 박스 플롯이 숨겼을 이봉이나 다중 모드 분포를 드러낼 때
  • Revealing bimodal or multimodal distributions that box plots would hide
  • 서로 다른 값에서 데이터의 밀도(관측치가 집중되는 지점)를 보여줄 때
  • Showing the density of data at different values (where observations concentrate)
  • 밀도 추정에 익숙한 청중에게 통계 결과를 제시할 때
  • Presenting statistical results to an audience comfortable with density estimation

이럴 땐 피하세요 / When NOT to Use

  • 표본 크기가 매우 작을 때(그룹당 20개 미만) -- KDE가 과도하게 매끄러워져 형태가 오도할 수 있습니다; 스트립 플롯이나 지터링된 점을 사용한 박스 플롯을 사용하세요
  • When you have very small sample sizes (fewer than 20 per group) -- the KDE will oversmooth and the shape will be misleading; use a strip plot or box plot with jittered points
  • 청중이 밀도 플롯에 익숙하지 않을 때 -- 히스토그램이나 박스 플롯이 더 명확하게 전달할 수 있습니다
  • When the audience is unfamiliar with density plots -- a histogram or box plot may communicate more clearly
  • 정확한 백분위수나 이상치 값을 보여줘야 할 때 -- 박스 플롯 오버레이와 함께 사용하거나 박스 플롯만 단독으로 사용하세요
  • When you need to show exact percentiles or outlier values -- pair with a box plot overlay or use a box plot alone
  • 범주가 많을 때(15개 초과) -- 화면이 복잡해집니다; 패싯팅이나 릿지라인 플롯을 고려하세요
  • When you have many categories (>15) -- the display becomes cluttered; consider faceting or a ridgeline plot

구조 / Anatomy

  • 밀도 형태(바이올린 본체): 추정된 분포를 보여주는 대칭 KDE 곡선으로, 데이터가 밀집한 곳에서 더 넓어집니다
  • Density shape (violin body): The mirrored KDE curve showing the estimated distribution, wider where data is dense
  • 중심 표시: 흔히 작은 박스 플롯(박스 + 중앙값 선)이나 중앙값을 나타내는 단일 점입니다
  • Central marker: Often a small box plot (box + median line) or a single point for the median
  • 위스커 또는 사분위 범위 표시: 바이올린 내부에서 사분위수나 백분위 범위를 표시하는 선택적 선
  • Whiskers or IQR indicators: Optional lines inside the violin marking quartiles or percentile ranges
  • 범주 축: 한 축을 따라 배열된 그룹
  • Category axis: Groups arranged along one axis
  • 값 축: 연속적인 측정 척도
  • Value axis: The continuous measurement scale
  • 대역폭 매개변수: KDE의 매끄러움을 제어합니다(눈에 보이지 않지만 형태에 결정적입니다)
  • Bandwidth parameter: Controls smoothness of the KDE (not visible, but critical to the shape)

변형 / Variations

  • 분할 바이올린: 각 절반이 서로 다른 하위 그룹(예: 남성 대 여성)을 보여주어, 범주 내 직접 비교가 가능합니다
  • Split violin: Each half shows a different sub-group (e.g., male vs. female), enabling direct within-category comparison
  • 바이올린 + 지터링된 점: 원본 데이터 포인트가 바이올린 내부에 흩뿌려져 표본 크기와 개별 값을 보여줍니다
  • Violin + jittered points: Raw data points are scattered inside the violin to show sample size and individual values
  • 바이올린 + 박스 플롯: 각 바이올린 내부에 축소된 박스 플롯이 그려져 두 표현 방식을 결합합니다
  • Violin + box plot: A miniature box plot is drawn inside each violin, combining both representations
  • 릿지라인 플롯(조이 플롯): 수직으로 쌓인 겹치는 밀도 플롯으로, 범주가 많고 분포 형태를 콤팩트하게 보여주고 싶을 때 유용합니다
  • Ridgeline plot (joy plot): Overlapping density plots stacked vertically, useful when there are many categories and you want to show distribution shape compactly
  • 빈 플롯: 바이올린과 유사하지만 개별 데이터 포인트를 작은 선으로, 평균을 굵은 선으로 포함합니다
  • Bean plot: Similar to violin but includes individual data points as small lines and a bold line for the mean

코드 레퍼런스 / Code Reference

// D3-based violin with density estimation
import * as Plot from "@observablehq/plot";

// Observable Plot doesn't have a native violin mark,
// but you can build one with the density and area marks:
Plot.plot({
  y: {grid: true},
  facet: {data, x: "category"},
  marks: [
    Plot.areaY(data, Plot.binX({y: "count"}, {
      x: "value", fill: "category", curve: "basis"
    })),
    Plot.ruleY([0])
  ]
})