如何在 R 中复制绘图
你能帮我如何在我的 R 图表中添加数据标签吗
date = c(1.45,0.89,0.74,3.28)
plot(date,type = "l")
我需要显示百分比
回答
使用text.
不过,首先,我将扩展轴限制以腾出空间。
plot(date, type = "l", xlim = c(0.5, 4.5), ylim = range(date) + c(-0.5, 0.5))
text(seq_along(date), date+0.2, paste(date, "%"))
任意组件:
- 我扩大了 0.5 以下和 0.5 以上的范围
date,如果您的数据发生变化,可能需要玩这个 - 我曾经
date + 0.2将数字稍微移动到点上方;