A violin plot is a statistical graphic for comparing probability distributions. It is similar to a box plot, with the addition of a rotated kernel density plot on each side.[1]
Violin plots are similar to box plots, except that they also show the probability density of the data at different values, usually smoothed by a kernel density estimator. Typically a violin plot will include all the data that is in a box plot: a marker for the median of the data; a box or marker indicating the interquartile range; and possibly all sample points, if the number of samples is not too high.
Violin plots are available as extensions to a number of software packages such as DataVisualization on CRAN[2] and the md-plot package on PyPI.[3]
A violin plot is more informative than a plain box plot. While a box plot only shows summary statistics such as mean/median and interquartile ranges, the violin plot shows the full distribution of the data. The difference is particularly useful when the data distribution is multimodal (more than one peak). In this case a violin plot shows the presence of different peaks, their position and relative amplitude.
Like box plots, violin plots are used to represent comparison of a variable distribution (or sample distribution) across different "categories" (for example, temperature distribution compared between day and night, or distribution of car prices compared across different car makers).
A violin plot can have multiple layers. For instance, the outer shape represents all possible results. The next layer inside might represent the values that occur 95% of the time. The next layer (if it exists) inside might represent the values that occur 50% of the time.
Although more informative than box plots, they are less popular. Because of their unpopularity, they may be harder to understand for readers not familiar with them. In this case, a more accessible alternative is to plot a series of stacked histograms or kernel density distributions.
Violin plots are available as extensions to a number of software packages, including the R packages vioplot, wvioplot, caroline, UsingR, lattice and ggplot2, the Stata add-on command vioplot,[4] and the Python libraries matplotlib,[5] Plotly,[6] ROOT[7] and Seaborn,[8] a graph type in Origin,[9] IGOR Pro,[10] Julia statistical plotting package StatsPlots.jl[11] and DistributionChart in Mathematica.