# Violin plot

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/Violin_plot
> Markdown URL: https://mediated.wiki/source/Violin_plot.md
> Source: https://en.wikipedia.org/wiki/Violin_plot
> Source revision: 1350950648
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

{{short description|Method of plotting numeric data}}
thumb|right|320px|Example of a violin plot
[[File:Violinplot-hiv-paper-plot-pathogens.svg|thumb|right|320px|Example of a violin plot in a scientific publication in [PLOS Pathogens](/source/PLOS_Pathogens).]]
A '''violin plot''' (also known as a '''bean plot''') is a [statistical graphic](/source/statistical_graphics) for comparing [probability distribution](/source/probability_distribution)s. It is similar to a [box plot](/source/box_plot), but has enhanced information with the addition of a rotated [kernel density plot](/source/kernel_density_estimation) on each side.<ref name=":1">{{cite web |title=Violin Plot |date=2015-10-13 |work=NIST DataPlot |publisher=National Institute of Standards and Technology |url=http://www.itl.nist.gov/div898/software/dataplot/refman1/auxillar/violplot.htm}}</ref>

== History ==
The violin plot was proposed in 1997 by Jerry L. Hintze and Ray D. Nelson as a way to display even more information than [box plot](/source/box_plot)s, which were created by [John Tukey](/source/John_Tukey) in 1977.<ref name=":0">{{Cite journal |last=Hintze |first=Jerry L. |last2=Nelson |first2=Ray D. |date=May 1998 |title=Violin Plots: A Box Plot-Density Trace Synergism |url=http://www.tandfonline.com/doi/abs/10.1080/00031305.1998.10480559 |journal=The American Statistician |language=en |volume=52 |issue=2 |pages=181–184 |doi=10.1080/00031305.1998.10480559 |issn=0003-1305|url-access=subscription }}</ref> The name comes from the plot's alleged resemblance to a [violin](/source/violin).<ref name=":0" />

== Description ==
Violin plots are similar to [box plot](/source/box_plot)s, except that they also show the [probability density](/source/Probability_density_function) of the data at different values, usually smoothed by a [kernel density estimator](/source/kernel_density_estimator). 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.

While a box plot shows a summary statistics such as median and interquartile ranges, the violin plot shows the full distribution of the data. The violin plot can be used in multimodal data (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.

Violin plots are less popular than box plots. Violin plots 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 plots](/source/Kernel_density_estimation).

The original meaning of "violin plot" was a combination of a box plot and a two-sided kernel density plot.<ref name=":1" /> However, currently "violin plots" are sometimes understood just as two-sided kernel density plots, without a box plot or any other elements.<ref>{{Cite book |last=Wilke |first=Claus O. |url=https://clauswilke.com/dataviz/boxplots-violins.html |title=Fundamentals of Data Visualization}}</ref><ref>{{Cite web |title=Violin plot — geom_violin |url=https://ggplot2.tidyverse.org/reference/geom_violin.html |access-date=2023-11-19 |website=ggplot2.tidyverse.org |language=en}}</ref>

==See also==
* [Sina plot](/source/Sina_plot)
* [Box plot](/source/Box_plot)

==References==
{{reflist}}

== External links ==
{{Commons category|Violin plots}}
* [http://ideas.repec.org/c/boc/bocode/s456902.html  Vioplot add-in for Stata]
* [https://seaborn.pydata.org/examples/wide_form_violinplot.html Violinplot from a wide-form dataset] with the [https://seaborn.pydata.org/ seaborn] statistical visualization library based on [matplotlib](/source/matplotlib)

{{NIST-PD|url=http://www.itl.nist.gov/div898/software/dataplot/refman1/auxillar/violplot.htm|article=Dataplot reference manual: Violin plot}}

{{Statistics}}

Category:Statistical charts and diagrams

---
Adapted from the Wikipedia article [Violin plot](https://en.wikipedia.org/wiki/Violin_plot) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/Violin_plot?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
