【发布时间】:2021-09-19 00:45:50
【问题描述】:
我正在尝试将另一列(年份)的标签添加到我的 ggplot 图中,但它给了我以下错误:
Error: geom_text_repel requires the following missing aesthetics: label
我的数据:thirdgraph2
year pdor juni
2016 1991-06-26 13305.0
2019 1991-06-16 13598.0
2017 1991-06-17 13944.5
2018 1991-06-17 15653.5
2015 1991-07-08 17143.0
这是我使用的代码:
ggplot(thirdgraph2, aes(juni, pdor, label=rownames(thirdgraph2$year))) +
geom_point() +
theme_bw() +
labs(y="Calculated date of reproduction",
x="Accumulated GDD until 17th June") +
geom_text_repel()
所以我喜欢标签是年份而不是默认的 1-5。有人知道方法吗?
【问题讨论】: