r - R : add horizontal lines below the plot region 中的条形图标签

标签 r bar-chart

我的代码:

x <- c(10, 50, 20, 40)
barplot(x, names.arg=LETTERS[1:4])

我想要的是:

enter image description here

我在 R 和 Adob​​e Acrobat 的帮助下制作了这个图。我想知道我能否使用纯 R 代码获得此图?

最佳答案

您可以使用 mtext 添加文本

mtext("E", side = 1, line = 3, adj = 0.375)
mtext("F", side = 1, line = 3, adj = 0.875)

然后用lines画线,但指示xpd=T

lines(c(0,3.5),c(-10,-10),xpd=TRUE)
lines(c(3.8,4.8),c(-10,-10),xpd=TRUE)

但是,您需要手动调整它。 enter image description here

关于r - R : add horizontal lines below the plot region 中的条形图标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34016393/

相关文章:

R 和 DT - 您可以将行副标题和组添加到数据表中吗?

r - 是否有 R 等价于其他语言的三重引号?

r - 从多边形子集中提取栅格内值的百分比分布

r - 如何在ggplot2中分离数据的年份而不将数据添加到框架中?

r - 使用 geom_text 在填充条形图中居中标签

sql-server - SSRS条形图问题

r - 如何在并行计算期间写出日志?如何调试并行计算?

r - h2o.deeplearning 中的意外预测

android - 如何在 Kotlin 中使用 MPAndroidChart 为条形图添加带有一些详细信息的标记?

python - plotly Python : Align X-Axes in a grouped bar chart with multiple Y-axis