R:Barplot,直接在bar旁边添加值,在单独的列中添加描述

时间:2015-05-21 12:15:37

标签: r bar-chart

我怎样才能在R中达到这样的效果: enter image description here

1 个答案:

答案 0 :(得分:3)

像这样?

vec <- runif(5)
plot(0,0,type="n",xlim=c(0,1.5),ylim=c(0,7),bty="n",axes="off")
at<-barplot(vec,horiz=TRUE,add=TRUE)
text(vec,at,signif(vec,1),pos=4)
text(rep(1,5),at,c("mn","lu","co","-","my"))