# What is this type of plot called with side-by-side centered horizontal density bars?

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

EDIT: many thanks all - very helpful.

• Looks like a bunch of population pyramid charts. Feb 3, 2016 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, 2016 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. Feb 4, 2016 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.
– bjw
Feb 5, 2016 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. Feb 5, 2016 at 18:51

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:

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

• Don't sell yourself short. This does answer the second half of the question: "is it possible to create them in R?" Feb 3, 2016 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 Feb 3, 2016 at 22:02
• @Jason You can always comment on your own posts. I expect you'll be able to comment everywhere quite soon. Feb 3, 2016 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."

• Let's call it quantized violin plots :) Feb 3, 2016 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 Feb 4, 2016 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.
– bjw
Feb 4, 2016 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. Feb 4, 2016 at 16:43
• @nickcox ... aren't density plots just smoothed histograms?
– bjw
Feb 5, 2016 at 18:43