I am creating several raincloud plots and am wondering how I can change the style to look more free flowing like [![this]
here is the code I am using adapted to iris.
iris %>%
dplyr::group_by(Species) %>%
dplyr::mutate(
mean = mean(Petal.Length),
se = sd(Petal.Length) / sqrt(length(Petal.Length)),
species_y = paste0(Species, "\n(", n(), ")")
) %>%
ungroup() %>%
ggplot(aes(x = Petal.Length, y = species_y)) +
stat_slab(aes(fill = Species)) +
stat_dots(aes(color = Species), side = "bottom", shape = 16) +
scale_fill_brewer(palette = "Set1", aesthetics = c("fill", "color")) +
geom_errorbar(aes(
xmin = mean - 1.96 * se,
xmax = mean + 1.96 * se
), width = 0.2) +
stat_summary(fun = mean, geom = "point", shape = 16, size = 3.0) +
theme_bw(base_size = 10)
The "free-flowing" look can be achieved by using
geom_pointandggpp::position_jitternudgeThe means are centered in the given example, so it's not really clear what you mean here.