In ggplot, boxplotit is easy to use jitter to add source data points with varying degrees of jitter. With zero jitter, the following code
dat <- data.frame(group=c('a', 'b', 'c'), values = runif(90))
ggplot(dat, aes(group, values)) +
geom_boxplot(outlier.size = 0) +
geom_jitter(position=position_jitter(width=0), aes(colour=group), alpha=0.7) +
ylim(0, 1) + stat_summary(fun.y=mean, shape=3, col='red', geom='point') +
opts(legend.position = "right") + ylab("values") + xlab("group")
displays the graph below.
Is it possible to use zero jitter, but add an offset so that the points are in the line, but are shifted to the left by 25% of the window width? I tried geom_pointwith help dodge, but it caused a jitter.
source
share