I am trying to recreate a multiple dot plot like the figure below. https://www.dropbox.com/s/9jqguesqd5gdm99/jitter%20plot.png
Both geom_dotplot and position_jitter in ggplot2 have been tried. But neither of these two commands could make it.
The figure created by position_jitter is quite similar, but there are also some differences. The point created by position_jitter seems too scattered, compared to the figure mentioned above.
This is the figure I could make so far. https://www.dropbox.com/s/athsgkjjrlwr15k/figure.png?dl=0 e.g.
value<-c(141573, 262616, 66773.8, 93032.2, 55528.8, 113125, 252954, 275581, 207854, 183300, 292946, 171510, 343565, 214436, 295871, 187196, 207352, 180356, 158110, 241769, 180112, 194007, 529168, 229267, 344257, 337311, 255109, 307389, 416108, 405033, 292260, 354368, 416811, 330420, 353017, 333997, 389285, 289870, 289224, 401641, 206481, 367379)
group<-factor(c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2))
quantile<-boxplot(value~group)
line<-quantile$stats
library(ggplot2)
gg<-ggplot()+geom_point(aes(x=group,y=value,color=group,fill=group),position=position_jitterdodge(jitter.width=0.3,dodge.width=0.7),size=4)+
geom_path(aes(x=c(0.8,1.2),y=c(line[3,1],line[3,1])),size=1)+geom_path(aes(x=c(1.8,2.2),y=c(line[3,2],line[3,2])),size=1)+geom_path(aes(x=c(0.9,0.9,1.1,1.1),y=c(line[2,1],line[2,1],line[2,1],line[2,1])),size=1.2)+geom_path(aes(x=c(0.9,0.9,1.1,1.1),y=c(line[4,1],line[4,1],line[4,1],line[4,1])),size=1.2)+geom_path(aes(x=c(1.9,1.9,2.1,2.1),y=c(line[2,2],line[2,2],line[2,2],line[2,2])),size=1.2)+geom_path(aes(x=c(1.9,1.9,2.1,2.1),y=c(line[4,2],line[4,2],line[4,2],line[4,2])),size=1.2)+geom_path(aes(x=c(1,1),y=c(line[2,1],line[4,1])),size=1.2)+geom_path(aes(x=c(2,2),y=c(line[2,2],line[4,2])),size=1.2)+
scale_colour_manual(name="",values = c("1"="#353F6B","2"="#994642"))+
theme_classic()+theme(legend.position="none")
gg
So my question: When using jitter function in ggplot2, is it possible to make outliers center, just like the first figure. And what kind of method would you suggest for creating this kind of figure?
Thanks