首先,您是一个图例,因为您映射到 size aes 而不是使用大小作为参数,即在 aes() 之外。其次,您会收到一个错误,因为arrow() 没有大小参数。见?arrow。
相反,您可以像这样增加箭头的大小:
library(emmeans)
library(ggplot2)
warp.lm <- lm(breaks ~ wool * tension, data = warpbreaks)
warp.emm <- emmeans(warp.lm, ~ tension | wool)
g <- plot(warp.emm, by = NULL, comparisons = TRUE, adjust = "mvt",
horizontal = FALSE, colors = c("darkgreen"))
检查 ggplot 对象,我们看到它由五层组成,其中箭头是通过geom_segment 第 3 层和第 4 层绘制的:
g$layers
#> [[1]]
#> geom_point: na.rm = FALSE
#> stat_identity: na.rm = FALSE
#> position_identity
#>
#> [[2]]
#> mapping: xend = ~ucl, yend = ~pri.fac, x = ~lcl, y = ~pri.fac
#> geom_segment: arrow = NULL, arrow.fill = NULL, lineend = butt, linejoin = round, na.rm = FALSE
#> stat_identity: na.rm = FALSE
#> position_identity
#>
#> [[3]]
#> mapping: xend = ~lcmpl, yend = ~pri.fac, x = ~the.emmean, y = ~pri.fac
#> geom_segment: arrow = list(angle = 30, length = 0.07, ends = 2, type = 2), arrow.fill = NULL, lineend = butt, linejoin = round, na.rm = FALSE
#> stat_identity: na.rm = FALSE
#> position_identity
#>
#> [[4]]
#> mapping: xend = ~rcmpl, yend = ~pri.fac, x = ~the.emmean, y = ~pri.fac
#> geom_segment: arrow = list(angle = 30, length = 0.07, ends = 2, type = 2), arrow.fill = NULL, lineend = butt, linejoin = round, na.rm = FALSE
#> stat_identity: na.rm = FALSE
#> position_identity
#>
#> [[5]]
#> geom_point: na.rm = FALSE
#> stat_identity: na.rm = FALSE
#> position_identity
因此,要增加箭头的粗细,您可以像这样设置这些层的size 参数:
g$layers[[3]]$aes_params$size = 1.5
g$layers[[4]]$aes_params$size = 1.5
g
由reprex package (v2.0.0) 于 2021 年 5 月 30 日创建