I want to use geom_text to add some character to the error bar in ggplot2. But it is not properly set.

I used the following commands

library(ggplot2)

library(readr)

b1 <- read_csv("C:/Users/ronyg/Downloads/b1.csv")

cha=c('ad','ad','ad' ,'b', 'ac', 'acd', 'ad', 'bc', 'd')

ggplot(b1, aes(x=Pond, y=Mean, fill=Sample)) +

geom_bar(stat="identity", color="black", position=position_dodge()) +

geom_errorbar(aes(ymin=Mean-Sd, ymax=Mean+Sd), width=.2,

position=position_dodge(.9))

p<-ggplot(b1, aes(x=Pond, y=Mean, fill=Sample)) +

geom_bar(stat="identity", color="black", position=position_dodge()) +

geom_errorbar(aes(ymin=Mean-Sd, ymax=Mean+Sd), width=.2,

position=position_dodge(.9))

**p+geom_text(aes(label =cha, y=Mean+Sd, hjust =-1))** this code needs to accurately set, I think

The data are

Pond | Sample | Mean | Sd |
---|---|---|---|

P1 | S2 | 10.62 | 1.15 |

P1 | S4 | 9.42 | 1.18 |

P1 | S6 | 9.18 | 1.19 |

P2 | S2 | 18.8 | 1.13 |

P2 | S4 | 13.43 | 1.13 |

P2 | S6 | 11.73 | 1.13 |

P3 | S2 | 14.22 | 1.13 |

P3 | S4 | 16.48 | 1.13 |

P3 | S6 | 7.98 | 1.18 |

Can you please help me to fix the problem.

The plot made by my commands is..

Thanks in advance