This is a joyplot: a series of histograms, density plots or time series for a number of data segments, all aligned to the same horizontal scale and presented with a slight overlap.
— Henrik Lindberg (@hnrklndbrg) July 8, 2017
The name "Joy Plot" was apparently coined by Jenny Bryan in April 2017, in response to one of Lindberg's earlier visualizations using this style. (The community appears to have settled on 'joyplot' since then.) The name refers to the classic 1979 Joy Division "Unknown Pleasures" album cover, which was in actuality a joyplot of radio intensities from the first known pulsar. The album cover reproduced the design from a 1971 Scientific American article about pulsars.
Lindberg created the chart above using a simple R script and some ggplot2 calls, but now it's even easier to create joyplots in R thanks to the ggjoy package by Claus Wilke, now available on CRAN. The vignette provides instructions on how to use the package to create your own joyplots: you can either use the
geom_ridgeline geom to plot individual lines (useful if your data is already in density or time series format), or use
geom_joy to calculate densities from the samples . There's also a
theme_joy theme which eliminates the traditional ggplot grid for a cleaner result more reminiscent of the classic 1971 joyplot. You can see several examples (with code) in this gallery, and I've also included a couple of other examples below.
Polarization of the US House of Representative members in the Democratic and Republican parties (based on code by Ian McDonald):
— G Elliott Morris?? (@gelliottmorris) July 22, 2017
Worker wages by industry:
— Hernando Cortina (@cortinah) July 25, 2017
As you can see from the examples above, joyplots work best when you want to compare the distributions of several subgroups, and the number of groups is large (so that a traditional panel plot would take up too much space). That said, joyplots do inevitably obscure some data due to the overlap, and you may want to consider alternatives like heat maps or even simple bar charts of means or medians. In any case, the new ggjoy package makes it easy to try them out and decide what works best for your data.
Github (clauswilke): ggjoy: Geoms to make joy plots using ggplot2