Graphics Reference
In-Depth Information
Figure 6-21. A violin plot
Discussion
Violin plots are a way of comparing multiple data distributions. With ordinary density curves, it
is difficult to compare more than just a few distributions because the lines visually interfere with
each other. With a violin plot, it's easier to compare several distributions since they're placed side
by side.
A violin plot is a kernel density estimate, mirrored so that it forms a symmetrical shape. Tradi-
tionally, they also have narrow box plots overlaid, with a white dot at the median, as shown in
Figure 6-22 . Additionally, the box plot outliers are not displayed, which we do by setting out-
lier.colour=NA .:
p + geom_violin() + geom_boxplot(width = .1 , fill = "black" , outlier.colour = NNA ) +
stat_summary(fun.y = median, geom = "point" , fill = "white" , shape = 21 , size = 2.5 )
Search WWH ::




Custom Search