【发布时间】:2021-01-25 22:58:18
【问题描述】:
我有一个模拟数据cp
id val. tag
id1 12.60 A
id2 12.48 A
id3 12.48 B
id4 13.95 B
id5 12.60 A
id6 12.48 A
id7 11.13 A
id8 9.56 A
id9 10.32 B
id10 9.569 B
我使用geom_text_repel() 来标记post 推荐的点
我的代码:
ggplot(cp, aes(x=tag, y=val,label=id)) + geom_boxplot()+ geom_dotplot(binaxis='y', stackdir='center', dotsize=1)+geom_text_repel(arrow = arrow(length = unit(0.02, "npc")),box.padding = 1) + theme_bw()
情节
我的问题:
如何调整参数以清除id-arrow-dot?例如,这里 id1,id2,id5 和 id6 聚集在一起,很难分辨每个箭头指向哪个样本。
谢谢。
【问题讨论】:
-
他们不是有相同的值并且属于同一个标签吗?
-
@Tung 是的,对于重叠的点,这有点棘手。即使 id1 和 id5 具有相同的值,箭头也应该指向各自的点,而不是两个箭头指向单个点。