将胡须末端放在boxplot上 [英] Put whisker ends on boxplot

查看:285
本文介绍了将胡须末端放在boxplot上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在垂线的末端加上垂线,就像 boxplot 函数自动给出的一样。

解决方案

正如@Roland暗示但未实现的那样,您可以使用 stat_boxplot 来实现这一点。调用 _boxplot 两次的技巧是将 geom 设置为 errorbar R 使用笔和纸的方式,所以建议您使用笔和纸的方式。

使用@ Roland的虚拟数据 df

p>

  ggplot(df,aes(x = cond,y = value))+ 
stat_boxplot(geom ='errorbar') +
geom_boxplot()#statistboxbox的缩写(geom ='boxplot')



stat_boxplot ?stat_boxplot )详细说明计算出的各种值并保存在 data.frame


I would like to put perpendicular lines at the ends of the whiskers like the boxplot function automatically gives.

解决方案

As hinted but not implemented by @Roland, you can use stat_boxplot to implement this. The trick calling _boxplot twice and is to set the geom to errorbar for one of the calls.

Note that as R uses a pen and paper approach it is advisable to implement the error bars first the draw the traditional boxplot over the top.

Using @Roland's dummy data df

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

The help for stat_boxplot (?stat_boxplot) detail the various values computed and saved in a data.frame

这篇关于将胡须末端放在boxplot上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆