When reading scientific papers I often come across plots where points are jittered without overlaping each other. I suspect many of them are drawn with a program called GraphPad
Here is a ggplot2 solution using geom_dotplot()
:
library(ggplot2)
set.seed(1234)
dat = data.frame(y=c(rpois(20, 4), rpois(20, 1), runif(20, 0, 20)),
category=rep(c("group_1", "group_2", "group_3"), c(20, 20, 20)))
dotplot_1 = ggplot(dat, aes(x=category, y=y)) +
geom_dotplot(aes(fill=category), binaxis="y",
stackdir="center", binwidth=0.8) +
stat_summary(fun.y=median, fun.ymin=median, fun.ymax=median,
geom="crossbar", width=0.7)
ggsave("dotplot_1.png", dotplot_1, width=6, height=4)