简体   繁体   中英

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

And I'm at the mean_sdl function, trying to add summary statistics to my violin plots. 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. 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 )

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 . 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 .)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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