ggplot2:boxplot是否仅用于计算位于y轴限制内的值? [英] ggplot2: does boxplot use for calculations only values lying within limits of y-axis?

查看:175
本文介绍了ggplot2:boxplot是否仅用于计算位于y轴限制内的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到boxplot的中位数(用限制ylim参数构造)可能不同于median() - 函数或boxplot没有调整后的y轴获得的中位数。

这是否意味着boxplot仅用于计算位于y轴定义区间内的值?
如果是这样,我怎么才能得到正确的boxplot(基于所有值),但在y.axis的特定间隔??



谢谢 使用 ylim 限制ý。在ggplot中,超出刻度极限的数据将被丢弃,并且不包含在任何统计计算(例如箱形图)中。为了在不改变所包含的数据的情况下缩放轴,使用 coord_cartesian(ylim = ...)


I noticed that median of boxplot (constructed with restricted ylim-parameter) may differ from the median obtained by median()-function or boxplot without adjusted y-axis.

Does it mean that boxplot use for calculations only values lying within defined interval of y-axis?? And if so, how could I get correct boxplot (based on all values), but plot it on particular interval of y.axis??

Thank you very much.

解决方案

Using ylim restricts the scale for y. In ggplot, data that falls outside the scale's limits is discarded and is not included in any statistical computations (such as boxplots). To just zoom the axes without changing the data that is included, use coord_cartesian(ylim=...).

这篇关于ggplot2:boxplot是否仅用于计算位于y轴限制内的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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