ggplot2 stat_summary 忽略 mult 参数

ggplot2 stat_summary ignoring mult parameter

所以我正在关注这个 ggplot2 小提琴图指南: http://www.sthda.com/english/wiki/ggplot2-violin-plot-quick-start-guide-r-software-and-data-visualization

我在 mean_sdl 函数中,试图将汇总统计信息添加到我的小提琴图中。代码运行正常,但出现错误 "Warning: Ignoring unknown parameters: mult." 这是代码:

> p<-ggplot(TG, aes(x=dose, y=len)) + geom_violin(trim=FALSE)
> p + stat_summary(fun.data="mean_sdl", mult=1, geom="crossbar", width=0.1)
Warning: Ignoring unknown parameters: mult
> p + stat_summary(fun.data=mean_sdl, mult=2, geom="pointrange", color="red")
Warning: Ignoring unknown parameters: mult

其中 mult 是乘以标准差的系数,它生成绘制的四分位数或范围的长度。有谁知道为什么会这样?我一直无法在网上找到任何东西。 同样的错误也在这个人的例子中不断出现:

(例如 https://ropensci.github.io/plotly/ggplot2/stat_summary.html

d + stat_sum_df("mean_sdl", mult = 1, mapping = aes(group = cyl))

Error: Unknown parameters: mult

使用 fun.args,可在 stat_summary 的文档中找到。例如:

ggplot(mtcars, aes(factor(cyl), hp)) + 
  geom_violin() + 
  stat_summary(fun.data = mean_sdl, fun.args = list(mult = 2))

(请注意,mean_sdl 默认为 2 mult。)