I am trying to indicate which treatments are significantly different from the control within each of my x-axis labels in a ggplot
bar graph.
I have Taxonomy as the x-axis and four different bars within each one indicating the experimental treatments and growth of each of these taxa for each treatment as the y-axis.
I attached a screenshot of a sample graph made using the code provided (with error bars eliminated from code) as well as some dummy data where "Y" indicates significance from control (feel free to make those numbers if that is easier).
I have tried using geom_signif
, but it seems that I am unable to add more then one comparison within the same x-axis column indicating differences only between columns themselves.
I have also tried plotting a geom_point
with values for each asterisk, but have not been able to align the asterisks with their respective treatment bars.
Any help would be much appreciated.
ggplot(Experiment, aes(x=Taxa, y=Growth, fill=Treatment)) +
geom_bar(stat="identity", size=0.5, color="black", position=position_dodge())+
scale_fill_manual(values=colorsvalue, name = expression(paste(Treatment)), labels=leglabs, position="top")+
ylab(expression( Growth~ (day^{-1})))+
theme_classic()+
theme (axis.title.x=element_blank()) +
scale_x_discrete (labels = xlabs)+
theme (axis.text.x = element_text(angle=90, hjust=1, size=10))+
theme(text = element_text(size=20))
Graph
Sample data
dput(data)
rather than as an image – nniloc