Visualization - Distributions - Violin

From Q
Jump to navigation Jump to search
VizIcon Violin Plot.svg

A Violin Plot is a rotated and mirrored density plot, with the range, quartiles, median, and mean value shown between the densities. Similar to a boxplot and histogram, violin plots are used to compare the distributions of different groups.

Example

The example below uses data from a fast-food tracking study. The violin plot shows the distribution of fast food consumed for different age groups.

Create a Violin Plot in Q

Object Inspector Options

The following is an explanation of the options available in the Object Inspector for this specific visualization. Refer to Visualization Options for general chart formatting options.

Chart

APPEARANCE
Plot vertically Rotates the plot by 90 degrees.
Plot the mean value If selected, a circle appears showing the mean.
Plot the median value If selected, a bar appears showing the median.
Plot the quartiles If selected, a thin rectangle appears, the ends of which indicate the upper and lower quartiles. Note that the quartiles in the violin plot can differ from quartiles in the box plot. Quartiles in the violin plot have been computed using i/(n+1) as the sample quantiles. This is equivalent to quantile(x, type = 6) in R or Method 11 in http://jse.amstat.org/v14n3/langford.html. The method is the default used in Minitab and SPSS.
Plot the range If selected, a line appears, the ends of which indicate the lowest and highest values observed in the data.
Bandwidth The relative width of the bandwidth used to compute the density (the smaller the value, the 'bumpier' the plot).
Automatically compute lower bound If selected, the left-side of the plot is set to the lowest value observed in the other data. Otherwise, it is set to be further to the left than this, so as to create a smooth end to the plot.

Acknowledgements

The density is computed using the base R density function and the plot is created using plotly.

More Information

How to create a violin plot in Displayr

Code

{
    "formChartType": "Violin",
    "formStackSeries": false,
    "formSmallMultiples": true,
    "formAsPercentages": false,
    "formScatterLabelType": "As hover text"
}