Hello,
I would like to connect related points that are separated within groups using geom_quasirandom, but am unsure how to do this. With geom_jitter this is done with the position_dodge argument (see here: https://stackoverflow.com/questions/39533456/how-to-jitter-both-geom-line-and-geom-point-by-the-same-magnitude), however, I am unable to figure this out for this package. I feel
Below is a reproducible example. I feel like this is close, however, the points and relevant lines are not in fact connected as they should be.
Any help or advice would be most appreciated. Thank you!!
library(ggplot2);library(ggbeeswarm);library(dplyr)
iris %>%
dplyr::mutate(flower = rep(1:nrow(iris), each = 3, len = nrow(iris))) %>% #make a variable to connect the dots
dplyr::mutate(timepoint = rep(c(1,2,3), each = 1, len = nrow(iris))) %>%
ggplot2::ggplot(aes(x = interaction(Species, timepoint), y = Petal.Width)) +
ggplot2::geom_boxplot(outlier.shape = NA) +
ggplot2::geom_line(aes(group = flower), color = "grey") +
ggbeeswarm::geom_quasirandom(groupOnX = T,
size = 4,
pch = 1,
aes(fill = Species)) +
theme_classic() +
theme(axis.text.x = element_text(angle = 45, hjust = 1))

Hello,
I would like to connect related points that are separated within groups using geom_quasirandom, but am unsure how to do this. With geom_jitter this is done with the position_dodge argument (see here: https://stackoverflow.com/questions/39533456/how-to-jitter-both-geom-line-and-geom-point-by-the-same-magnitude), however, I am unable to figure this out for this package. I feel
Below is a reproducible example. I feel like this is close, however, the points and relevant lines are not in fact connected as they should be.
Any help or advice would be most appreciated. Thank you!!