The fastest and clearest way to draw a raincloud plot with ggplot2 and ggdist
There’s actually a more concise way (like ggridges), but ggdist is easier to handle
Load the packages and write the codes as shown below.
That’s all. Pretty easy and straightforward, right?
library(tidyverse)
library(ggdist)
ggplot(iris, aes(x = Sepal.Length, y = Species, color = Species)) +
stat_halfeye(
point_color = NA, .width = 0, height = 0.6,
position = position_nudge(y = 0.3)
) +
geom_boxplot(
position = position_nudge(y = 0.2),
width = 0.1, outlier.shape = NA
) +
geom_point(position = position_jitter(width = 0, height = 0.1, seed = 1))