在 GGPLOT2 中向箱线图添加线条

Add line to Boxplot in GGPLOT2

有没有办法在 ggplot2 中向箱线图添加一条水平线,它不会穿过现有的绘图,而只会穿过中间的空间?

感谢您的帮助...

ggplot 将每个geom一个接一个地相加,所以...

library(ggplot2)
df <- data.frame(x = gl(3,1), y = 1:3)
ggplot(df, aes(x,y)) + 
  geom_hline(yintercept = 1.5) + 
  geom_col(width = .5)

... 在 geom_col 生成的柱下方放置一条水平线。