gpt4 book ai didi

r - 如何更改 stat_boxplot (误差条)的宽度

转载 作者:行者123 更新时间:2023-12-02 04:02:55 25 4
gpt4 key购买 nike

我正在使用 ggplot2 进行箱线图。
但是,我无法更改 stat_boxplot (geom ='errorbar') 的宽度。
这是我的代码的一部分:

geom_boxplot(width=0.5)+stat_boxplot(geom ='errorbar',width=0.5)

geom_boxplot() 可以,但是 stat_boxplot(geom ='errorbar') 的宽度没有改变。
有什么建议么?谢谢!

最佳答案

要调整 mustache 线的大小(宽度),我们可以在函数内使用参数stat_params = list(width = 0.5):stat_boxplot

library(ggplot2)
ggplot(iris, aes(factor(Species), Sepal.Width, fill = Species)) +
geom_boxplot() +
stat_boxplot(geom ='errorbar', stat_params = list(width = 0.5)) +

更新

Now我们可以在 stat_boxplot

中使用参数 width
library(ggplot2)
ggplot(iris, aes(factor(Species), Sepal.Width, fill = Species)) +
geom_boxplot() +
stat_boxplot(geom ='errorbar', width = 0.5)

enter image description here

关于r - 如何更改 stat_boxplot (误差条)的宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16796736/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com