Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What would you call this type of plot, and is it possible to create them in R?

EDIT: many thanks all - very helpful. Best title so far: quantised violin plots!

enter image description here

share|improve this question
Looks like a bunch of population pyramid charts. – Mateen Ulhaq Feb 3 at 19:37
Could you please explain how these plots work? What quantities do they represent and precisely how do they represent them? Without such information we could all be giving different answers to different interpretations of the question, which might leave everybody confused. – whuber Feb 3 at 21:29
@whuber's pertinent questions remain unanswered, which is very disappointing. But as I far as I can see these are just histograms side-by-side with centered (centred) bars. It's a clear majority convention to plot histograms with vertical bars, and a fairly common minority convention to show horizontal bars, but the logic of a histogram is seemingly followed here, namely that bar areas encode frequencies. Centred bars are quite common in archaeology and ecology. – Nick Cox Feb 4 at 16:43
@whuber My presumption is that we are to read these plots like histograms, and that this format is an alternative to overlaying histograms which allows us to compare means but at the same time visualise the distribution. So in that sense it's an extension of the box plot too. – ben Feb 5 at 18:41
How are means shown here? Or medians and quartiles? We are still lacking a source. Please give a reference and/or give the explanation provided with the original. – Nick Cox Feb 5 at 18:51
up vote 11 down vote accepted

Sorry I don't have enough street cred on CV to post a comment, where this is more appropriate, but here is a link to some code in R to perform something like what you've depicted, using base graphics to rotate histograms in place of the density function inherent in ggplot2:

from stack overflow:

if someone with appropriate powers cares to move this from answer to comment, please do.

share|improve this answer
+1 for a useful link. You deserve the street cred. – highBandWidth Feb 3 at 21:20
Don't sell yourself short. This does answer the second half of the question: "is it possible to create them in R?" – ssdecontrol Feb 3 at 21:52
yay! I can comment - thanks for the support. Was trying to abide by rules and not just post a link, but if it helps someone, that's all that's important – JasonD Feb 3 at 22:02
@Jason You can always comment on your own posts. I expect you'll be able to comment everywhere quite soon. – Glen_b Feb 3 at 22:59

It's a little hard to tell what the plots are supposed to represent, but they look an awful lot like violin plots.

A violin plot is essentially a vertical, doubled kernel density plot, so that the width along the x axis corresponds to greater density at the corresponding value along the y axis.

You can generate them in package lattice with panel.violin, or in ggplot2 with geom_violin.

Edit: there is also an R package called vioplot that (I think) uses only base R graphics, and a package called beanplot that generates something similar called a "bean plot."

share|improve this answer
Let's call it quantized violin plots :) – Franck Dernoncourt Feb 3 at 16:57
I build something similar but starting from a box plot - the "boxes" where not constant but represented the poportion of cases within that area – Christian Sauer Feb 4 at 9:09
Many thanks for this... I upvoted you but felt I had to accept the other answer as it actually showed how to do it in R, but I actually prefer bean plots now I've seen them, so thanks. – ben Feb 4 at 14:50
I'd advise against the violin plot terminology here, as the density estimation element is quite missing and that's not a widely known term in any case. – Nick Cox Feb 4 at 16:43
@nickcox ... aren't density plots just smoothed histograms? – ben Feb 5 at 18:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.