如何在基本 R 中不显示除 Y 轴外的任何轴来创建一个箱线图?


基本 R 中的 boxplot 函数帮助我们轻松创建箱线图,但此图由方括号包围,并且也在左侧带上了 Y 轴标签。我们可以在不影响 Y 轴标签的情况下摆脱此方括号。为此,我们需要在 boxplot 函数中使用 frame.plot = FALSE 参数。

示例 1

> x<-rnorm(1000)
> boxplot(x,frame.plot=FALSE)

输出

Explore our latest online courses and learn new skills at your own pace. Enroll and become a certified expert to boost your career.

示例 2

> y<-rpois(5000,20)
> boxplot(y,frame.plot=FALSE)

输出

示例 3

> z<-sample(0:9,500,replace=TRUE)
> boxplot(z,frame.plot=FALSE)

输出

更新于:2020 年 11 月 23 日

139 次浏览

开启你的 职业

通过完成课程获得认证

开始
广告