我在调整geom_label()
中的ggplot2
时出现问题,以致position_dodge()
无法正常工作。这两个标签彼此重叠...有什么想法吗?
reprex:
library(dplyr)
library(ggplot2)
tibble(
x = "Position 1",
y = 0,
label = c("Label A", "Label B")
) %>%
ggplot() +
geom_label(aes(x = x, y = y, label = label),
position = position_dodge(width = 1))
由reprex package(v0.3.0)在2019-11-29创建
尝试用position_dodge2
代替position_dodge
也记录在帮助文本中:
闪避在调整水平位置的同时保留了几何图形的垂直位置。 position_dodge2是position_dodge的一种特殊情况,用于安排箱形图,宽度可以变化。 position_dodge2也适用于条形和矩形。