I have some problems plotting error bars on the plot, they seem to gather at the centre of 2 bars, rather than on the centre of each bar.
data <- data.frame(
strain = rep(c("control", "7TM mutation"), each = 3),
compoundname = c("Diacetyl", "Benzaldehyde", "Octanol"),
IO = c(0.932, 0.790, -0.546, -0.016, 0.708, -0.600),
sd = c(0.044, 0.073, 0.205, 0.130, 0.210, 0)
)
ggplot(data) +
geom_bar( aes(x=compoundname, y=IO,fill= strain), stat="identity", alpha=0.5, position =
position_dodge()) +
scale_fill_manual(values = c("grey","black")) +
geom_errorbar( aes(x = compoundname, ymin=IO-sd, ymax=IO+sd), width=0.2, colour="black",
position = position_dodge(0.9))+
theme_light() +
xlab("Volatile Compound")+
ylab("Olfactory Index")