简体   繁体   中英

Insert text in geom_bar

I am trying to make a barplot in R using ggplot2 . I want to put the text D=3 in the graph located in the middle of x axis and in y=0.55, but I don´t know how. I've been looking for a solution but I have not found anything.

Thanks for help 在此处输入图片说明

I just found the answer in a blog. I just needed to use this code geom_text(data = NULL, x = 3.5, y = 0.55, label = "D=3", size=10) and I got next graph. I hope it can be useful for any of you. 在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM