R语言中barplot函数绘图实现x轴标签的倾斜显示

 

001、代码

dat <- c(3, 8, 2, 9, 4)
k <- barplot(dat,  axes = FALSE, ylim = c(-4, 10) ,names.arg = FALSE)
axis(2, at = seq(0, 10, 2))
label <- paste0("label", 1:5)
text(x = k, y = -1.5, labels = label, srt = 45)

绘图效果:

 

参考:http://www.360doc.com/content/17/0912/17/46931810_686548232.shtml

 

posted @ 2023-05-31 00:33  小鲨鱼2018  阅读(692)  评论(0编辑  收藏  举报