DVC Day 19: The World’s Smallest Violin

(This Post is part of my 30 day Data Visualization Challenge – you can follow along using the ‘challenge’ tag!)

Another way we can approach the overplotting problem (especially now that we recognize how useful but not-sexy box plots are) are a ggplot2 plot type called violin plots – here’s the same data as with the box-and-whiskers, but in the shape of everyone’s second-favorite string instrument:

Screen Shot 2015-05-01 at 4.20.37 PM

Thoughts:
– Much sexier than box-and-whisker!
– Despite being a bit nicer to look at, things like the median, outliers, etc, are not quite as easy to distinguish.
– The space to the right of each of the graphs is distracting – in the future I would probably do a harder line around each individual clarity box.

Code:

> library(ggplot2)
> fiddle <- ggplot(diamonds, aes(carat, price/carat)) + geom_violin(alpha=.65, fill="blue") + facet_grid(. ~ clarity)
> fiddle

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.