2

This may seem very trivial, but surprisingly I have not found an answer to my question. I am drawing boxplots with ggplot2, and some of my outliers have the same value. Unfortunately, ggplot2 does not automatically jitter/dodge them. Thus, although I could have 10 outliers with the same value, only one shows. How can I jitter/dodge them?

Here is a reproducible example where each boxplot has two outliers, but only one shows:

gender <- rep(c("m", "f"), times=24)
value <- rep(c(1, 3, 4, 6, 8, 20), each=2, times=4)
df <- data.frame(gender, value) 
box<-ggplot(df, aes(x=factor(gender), y=value, fill=factor(gender)))+
  geom_boxplot(notch=FALSE,lwd=0.8,outlier.colour="gray64",outlier.shape=16,outlier.size=1.5)
box

enter image description here

Mehdi.K
  • 371
  • 4
  • 15

0 Answers0