Silently failing with boxplots
My goal with this newsletter is to provide concise, actionable content that will steadily enhance your dataviz skills.
If no one has ever pointed out the boxplot problem to you, you're going to enjoy this reading!
What's wrong?
This is a familiar scenario.
You've got 4 groups in your dataset and need to compare their distributions.
So, you create a clean boxplot and call it a day!
Some charts can be ugly. Some can be hard to read. Some use bad colors. But this boxplot is much worse than that!
Can you spot what's wrong? Don't scroll down before taking a guess!
Boxplots are misleading
Indeed, there's something deeply misleading about the boxplot above: it hides the underlying distribution of each group.
Now, let's see what happens when you add the individual data points on top of each box using a technique called jittering:
Interesting!
- Group C and D have very low sample size
- Group B has a bimodal distribution
This is definitely a story you don't want to miss!
Alternatives
There are many alternatives to the boxplot.
You can show individual data points, like above. But with large datasets, dots will overlap, making it less effective.
In that case, a violin plot is a better option. (see it here)
Lastly, the raincloud plot—combining elements of both—is an excellent alternative.
Conclusion
I wrote a long form version of this in data-to-viz.com. It includes R code to build each of those alternatives!
If you enjoy dataviz caveats like this, I've created an entire collection!
See you next Saturday to talk about d3.js!
Yan
PS: please let me know if you like this kind of content. I know many other dataviz caveat I could share!
PPS: I often give dataviz talks with examples like this. Drop me an email if you want to train your team!
Enjoyed this?
Get one short, actionable dataviz tip every Saturday. Join 19,000+ data people.