简体   繁体   English

ggplot2 stat_summary忽略多参数

[英]ggplot2 stat_summary ignoring mult parameter

So I'm following this ggplot2 guide to violin plots: http://www.sthda.com/english/wiki/ggplot2-violin-plot-quick-start-guide-r-software-and-data-visualization 因此,我正在遵循ggplot2小提琴乐谱指南: http : //www.sthda.com/english/wiki/ggplot2-violin-plot-quick-start-guide-r-software-and-data-visualization

And I'm at the mean_sdl function, trying to add summary statistics to my violin plots. 我在mean_sdl函数中,尝试将摘要统计信息添加到我的小提琴图中。 The code runs just fine, but I get the error "Warning: Ignoring unknown parameters: mult." 该代码可以正常运行,但出现错误“警告:忽略未知参数:多”。 Here's the code: 这是代码:

> 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

Where mult is the factor by which you multiply the standard deviation, which generates the length of your plotted quartiles or range. 其中mult是乘以标准偏差的因子,它会产生绘制的四分位数或范围的长度。 Does anyone know why this might be happening? 有谁知道为什么会这样? I've been unable to find anything online. 我一直无法在网上找到任何东西。 The same error keeps popping up in this person's example as well: 此人的示例中也不断弹出相同的错误:

(eg https://ropensci.github.io/plotly/ggplot2/stat_summary.html ) (例如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

Use fun.args , which can be found in documentation for stat_summary . 使用fun.args ,可以在stat_summary文档中stat_summary For example: 例如:

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

(Note that mean_sdl has 2 as the default mult .) (请注意, mean_sdl有2个为默认mult )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM