I am trying to add significancy bar to may grouped barplot using geom_signif in R. The problem is that, since I have applied scale_x_discrete on x axis, I can't define numeric values like xmin and xmax for the begining and ending point of the significancy bar.
x=ggplot(data, aes(fill=condition ,x=names ,y=M$Mean, ymin=M$Mean-M$SE, ymax=M$Mean+M$SE))+
geom_bar(position="dodge", stat="identity", width=2.5)+
geom_errorbar(position=position_dodge(2.5) , aes(ymin =Mean))+
geom_signif(annotations = "***", xmin=1, xmax=2, y_position=7.05, tip_length=0.03)+
scale_x_discrete(limits=names )+
scale_fill_discrete(labels = c("D0", "D3", "D6" , "D12"))
I also did not succeed plot my desired significancy bars by using comparisons instead of xmax and xmin. The reason is that it is a grouped barplot and several conditions have the same x label.
Can anybody suggest a solution?