【发布时间】:2021-08-11 08:39:53
【问题描述】:
如果下面示例中的标签是重叠的,我们如何实现排斥选项?谢谢!
means <- df %>%
group_by(cyl) %>%
summarize(across(c(wt, mpg), mean))
ggplot(df) +
aes(x=wt, y=mpg, color=cyl, shape=cyl) +
geom_point() +
geom_point(size=4, data=means) +
geom_label(aes(label=cyl), color="black", data=means) -> fig
fig
如果我从ggrepel package 添加geom_label_repel()
fig + geom_label_repel()
我得到错误:
geom_label_repel requires the gollowing missing aesthetics: label
【问题讨论】:
-
您是否尝试将
geom_label(aes(label=cyl), color="black", data=means)替换为geom_label_repel(aes(label=cyl), color="black", data=means)? -
做到了,谢谢。如果您将此写到单独的答案中,我可以接受。