在R ggplot2中,如何(沿着x轴维)文本标签与下面的图中的抖动点对齐
library(dplyr)
library(ggplot2)
mtcars %>%
ggplot(aes(am, wt, group = am, label = wt)) +
geom_boxplot(outlier.shape = NA) +
geom_jitter() +
geom_text()

发布于 2018-09-13 15:57:50
简单的解决方案是使用相同的position_jitter在geom_text和geom_jitter中指定seed。
library(ggplot2)
ggplot(mtcars, aes(am, wt, group = am, label = wt)) +
geom_boxplot(outlier.shape = NA) +
geom_jitter(position = position_jitter(seed = 1)) +
geom_text(position = position_jitter(seed = 1))

https://stackoverflow.com/questions/52317280
复制相似问题