R语言在柱状图上添加文字

代码示例:

data <- data.frame(A = 1:2, B = 1:2, C = 1:2)
data <- data.matrix(data)

par(font = 2, lwd = 2)
barplot(data, col = c("black", "white"), beside = T, ylim = c(0, 2.5), font = 2)
text( x = b[,1], y = 0.05 + data[,1], adj = c(0.5, 0))
text( x = b[,2], y = 0.05 + data[,2], adj = c(0.5, 0))
text( x = b[,3], y = 0.05 + data[,3], adj = c(0.5, 0))
axis(side = 2, lwd = 2, font = 2)

效果图如下:

R语言在柱状图上添加文字_第1张图片

 

你可能感兴趣的:(R语言在柱状图上添加文字)