Hello,
I have managed to produce error bars from SD for my barplots when using only one variable, but once I try to include error bars for a data set with two variables, using position="dodge" and fill="variable", the error bars do not work.
I have included the ggplot code I have been using below as well as an image of the graph and some of the raw data in my table. Is there a way I can separate the error bars to be specific to either the Iron or no iron columns?
ggplot(data=Initial_iron_experiments, mapping=aes(x=Sample, y=Percentage_killing, fill=Iron))+
stat_summary(fun=mean, geom="col", position="dodge", colour="black")+
geom_errorbar(aes(x=Sample, ymin=mean(Percentage_killing)-SD, ymax=mean(Percentage_killing)+SD), width=0.5, colour="black", alpha=0.5, size=0.5)+
scale_y_continuous("Percentage killing", breaks=c(0,10,20,30,40,50,60,70,80,90,100))+
labs(title="Killing effect of P.aeruginosa on R.microsporus")+
theme(plot.title=element_text(hjust=0.5))