I am using facet wrap in ggplot to create boxplots. I am using the fill commend to further break up the data by color. Using other stackoverflow help, I've been able to add points on top of those boxplots. I am now trying to center those dots on each boxplot. As you can see in the screenshot, the dots are actually centered around the variable "salt" on the x axis, instead of being centered on their respective boxplot. Do you have any suggestions on how to deal with this?
Thanks so much for your help!
My code:
I<-ggplot(IntTrt72, aes(x=salt, y=rel_diff, fill = stage))+
geom_boxplot(outlier.size = 0.1) + theme_classic() +
theme(strip.background = element_blank(), strip.text.x = element_blank(), legend.position = "none")+
geom_dotplot(binaxis = 'y', stackdir = 'center', binwidth = .05,
color = NA,position = position_dodge())
I<-I+scale_fill_manual(values=c("#5445b1", "#749dae", "#f3c483"))+ theme_classic()+
theme(strip.background = element_blank(), strip.text.x = element_blank(), legend.position = "none")
I<- I+facet_wrap(treatmenthours~temp)
I<- I + geom_hline(yintercept=0, linetype="dashed", color = "grey60")
I<- I + scale_y_continuous( breaks=c(-1.0, -0.75, -0.5, -0.25, 0, 0.25), limits=c(-1.0, 0.3))
I
FYI, I am an R beginner.