gpt4 book ai didi

r - 将 mustache 末端放在箱线图上

转载 作者:行者123 更新时间:2023-12-03 07:01:10 25 4
gpt4 key购买 nike

我想在 mustache 的末端放置垂直线,就像 boxplot 函数自动给出的那样。

最佳答案

正如 @Roland 所暗示但未实现的,您可以使用 stat_boxplot 来实现这一点。调用 _boxplot 两次的技巧是将其中一次调用的 geom 设置为 errorbar

请注意,由于 R 使用笔和纸方法,建议首先实现误差线,然后在顶部绘制传统的箱线图。

使用@Roland的虚拟数据df

ggplot(df, aes(x=cond, y = value))  + 
stat_boxplot(geom ='errorbar') +
geom_boxplot() # shorthand for stat_boxplot(geom='boxplot')

enter image description here

stat_boxplot的帮助(?stat_boxplot) 详细说明了计算并保存在 data.frame

中的各种值

关于r - 将 mustache 末端放在箱线图上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12993545/

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