I have included reproducible code from the mtcars data set below:
library(ggplot2)
ggplot(mtcars,aes(as.factor(vs),disp))+
stat_boxplot(geom ='errorbar',position=position_dodge(width=.88),aes(fill=as.factor(am))) +
geom_boxplot(position=position_dodge(width=.88),aes(fill=as.factor(am)))+
geom_dotplot(binaxis='y', stackdir='center',dotsize=0.25,position=position_dodge(width=.88),stackratio=1.1,aes(fill=as.factor(am),color=as.factor(am)))
I would like to make the dots from the dotplot grey/black, while having control over the fill colour of the boxplots. As you can see, I need the fill colour aesthetic for both the boxplots and dotplots in order to separate the three factors on the x axis by the necessary group. Additionally, the dotplot's color aesthetic maps to the outline of the dots, while the fill aesthetic maps to the inside of the dots, so I need to use both, since I would like one seamless point. Using the scale_fill_manual function changes the colour of both boxplots and dots, but I need to have control over the colour of both separately.
I have found this other question on stackoverflow but I'm struggling to apply it to my case.
How to scale the size of line and point separately in ggplot2