VIOLIN PLOT
Name:
Type:
Purpose:
Description:
A violin plot is a combination of a box plot and a kernel
density plot. Specifically, it starts with a box plot.
It then adds a rotated kernel density plot to each side of the
box plot.
Enter HELP BOX PLOT and HELP KERNEL DENSITY PLOT for
details on the construction of box plots and kernel density
plots, respectively.
For the violin plot to appear as it should, the VIOLIN PLOT
command is usually preceded by the two commands:
CHARACTERS VIOLIN PLOT
LINES VIOLIN PLOT
These commands automatically define proper values for the 25
components of the violin plot. Note that traces 2 thru 25
correspond to the definitions for the traces in the standard
box plot (HELP BOX PLOT for details). Trace 1 draws the
kernel density portion.
After the violin plot is formed,
the analyst should redefine plot characters and lines via the
usual CHARACTERS and LINES commands.
Syntax:
VIOLIN PLOT <y> <x>
<SUBSET/EXCEPT/FOR qualification>
where <y> is the response (= dependent) variable;
<x> is an independent variable;
and where the <SUBSET/EXCEPT/FOR qualification> is optional.
Examples:
VIOLIN PLOT Y X
VIOLIN PLOT Y X SUBSET X > 2
Note:
Outliers on the box plot can be identified by entering the
FENCES ON command. If the interquartile range (i.e., the
difference between the 25% point and the 75% point) is IQ,
then values that are between 1.5 and 3.0 times the IQ above
(or below) the 75% point (or the 25%) point are drawn as circles
and points that are more than 3.0 times the IQ above (or below)
the 75% point (or the 25%) are drawn as large circles.
Note:
An alternate form for the appearance of the violin plot can
be generated by entering the commands CHARACTERS VIOLIN BOX PLOT
and LINES VIOLIN BOX PLOT. These draw the traditional form of
the box plot rather than the streamlined Tufte form of the
box plot.
You can also define your own plot symbols with the standard
CHARACTER and LINE commands (e.g., you may prefer to use a dash
() rather than the default X.
Note:
The width of the box is proportional to the number of data
points in that box. This only applies if the lines and
characters are set to LINES VIOLIN BOX PLOT and
CHARACTERS VIOLIN BOX PLOT, respectively. For the default
lines and character settings (LINE VIOLIN PLOT, CHARACTERS
VIOLIN PLOT), the width of the box is not relevant.
Note:
References:
"Violin Plots: A Box PlotDensity Trace Synergism",
Jerry L. Hintze and Ray D. Nelson, The American Statistician,
May 1998 Vol. 52, No. 2, 181184.
Default:
Synonyms:
CHARARCTER VIOLIN TUFTE BOX PLOT is equivalent to CHARACTER
VIOLIN PLOT. Similarly, LINES VIOLIN TUFTE BOX PLOT is
equivalent to LINE VIOLIN PLOT.
Related Commands:
BOX PLOT

= Generate a box plot.

KERNEL DENSITY PLOT

= Generate a kernel density plot.

CHARACTERS

= Sets the types for plot characters.

LINES

= Sets the types for plot lines.

REGION

= Sets the types for plot regions.

PLOT

= Generates a data or function plot.

Applications:
Exploratory Data Analysis, Comparing Distributions
Implementation Date:
Program:
SKIP 25
READ DRAFT69B.DAT Y XJUNK X
.
CHARACTER VIOLIN PLOT
LINE VIOLIN PLOT
XLIMITS 1 12
MAJOR XTIC MARK NUMBER 12
MINOR XTIC MARK NUMBER 0
XTIC OFFSET 1 1
X1TIC MARK LABEL FORMAT ALPHA
X1TIC MARK LABEL CONTENT JAN FEB MAR APR MAY JUN JUL AUG SEP OCT ...
NOV DEC
Y1LABEL DRAFT RANK
KERNEL DENSITY POINTS 32
.
VIOLIN PLOT Y X
Date created: 2/26/2003
Last updated: 4/4/2003
Please email comments on this WWW page to
alan.heckert@nist.gov.
