如何在带有交叉符号的箱线图中显示均值?


要在带有交叉符号的箱线图中显示均值,可以使用 points 函数并传入带有 pch = 4(表示星号)的均值,此外,还可以使用 col 参数更改颜色以突出显示均值,并且可以使用 lwd 参数更改星号大小,如下面的示例所示。

示例

 实时演示

x<-sample(0:9,100,replace=TRUE)
boxplot(x)

输出

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

示例

points(mean(x),col="blue",pch=4,lwd=6)

输出

更新于: 2021 年 3 月 16 日

301 次浏览

开启您的职业生涯

通过完成课程获得认证

立即开始
广告