Articles - R packages

ggjoy: Create a ggplot2-based Joyplots

  |   1466  |  Post a comment  |  R packages  |  R, R packages, ggplot2 extension

Joyplots consist of partially overlapping line plots for visualizing changes in distribution over time or space. Joyplots can be easily created in R using the ggjoy package, which is an extension of ggplot2.

Install ggjoy

install.packages("ggjoy")

Use ggjoy

In the example below, we’ll use the iris demo data set. We’ll visualize the distribution of the variable Sepal.Length by groups (“Species”).

library(ggplot2)
library(ggjoy)
ggplot(iris, aes(x = Sepal.Length, y = Species)) + 
  geom_joy() + 
  theme_joy()

Control the overlap of the different density plots. Use the argument scale.

ggplot(iris, aes(x = Sepal.Length, y = Species)) + 
  geom_joy(scale = 0.9) + 
  theme_joy()