Quantcast
Channel: Category Name
Viewing all articles
Browse latest Browse all 5971

Introducing Joyplots

$
0
0

This is a Joyplot: a series of histograms, density plots or time series for a series of samples, all aligned to the same horizontal scale and presented with a slight overlap.

Peak time for sports and leisure #dataviz. About time for a joyplot; might do a write-up on them. #rstats code at https://t.co/Q2AgW068Wa pic.twitter.com/SVT6pkB2hB

— 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, and reproduced from a 1971 edition of Scientific American.

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):

Asymmetric polarization: The entire GOP has moved to the right, where Dems have just become slightly less moderate. (H/t @ianrmcdonald) pic.twitter.com/IeIo959qRV

— G Elliott Morris📈🙂 (@gelliottmorris) July 22, 2017

Worker wages by industry:

The @justcapital_ worker wage data for this year's rankings is taking shape. #ESG #rstats Thank you @ClausWilke for the joyplot package pic.twitter.com/HBRuF7mIdq

— 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

 


Viewing all articles
Browse latest Browse all 5971

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>