I used ggplot2 to create the following barplot. However, I would like to add stars to show the significancy between the dark and light for the same treatment. For instance SW.5 treatment.
calen_per<- read.table("sadek calen percent.csv", sep=";",header = TRUE)
calen_per
DW SW.1 SW.2 SW.3 SW.4 SW.5 LVD
70 85 80 70 75 84 Light (79.5a)
75 90 85 77 72 86 Light (79.5a)
78 85 80 75 75 90 Light (79.5a)
72 70 74 65 70 70 Dark (70.8b)
75 72 70 70 72 75 Dark (70.8b)
70 75 70 70 65 70 Dark (70.8b)
cal_per <- melt(calen_per,id="LVD")
g8<-ggplot(cal_per, aes(x=variable, y=value, fill=as.factor(LVD)))
+ stat_summary(fun.y=mean,geom="bar",position=position_dodge(),
colour="black",width=.7,size=.5)+
stat_summary(fun.ymin=min,fun.ymax=max,geom="errorbar",
color="black",position=position_dodge(.7), width=.2) +
stat_summary(geom = 'text', fun.y = max, position = position_dodge(.7),
label = c("B","a","A","a","AB","a", "B","a","B","a","A","a"), vjust = -0.5)+
scale_fill_manual("marigold",
values = c("Light (79.5a)" = "white", "Dark (70.8b)" = "grey")) +
xlab("treatments")+ylab("percentage") +
theme(panel.background = element_rect(fill = 'white', colour = 'black'))+
ylim(0,120)
How can I do this?