[英]How to draw a boxplot whose staples looks like a square bracket in R
How to draw a box plot like this: 如何绘制这样的方框图:
make the staples, the mark of data within 1.5 IQR of the lower/upper quartile, looks like a square bracket. 制作订书钉,数据标记在下/上四分位数的1.5 IQR内,看起来像一个方括号。
I tried: 我试过了:
bx = sapply(5:1, function(x) rnorm(100, x, sqrt(x)))
boxplot(bx, col = "gray", pch = "", boxwex = 0.3,
medlwd = rep(3, 4), medcol = rep("white", 4),
outlty = 1, outwex = 1,
whisklty = 1,
staplelty = 1, staplewex = 1,
names = paste0("mu = ", 5:1))
title(main = "n = 100")
I do not believe it is possible to do this with staplelty
. 我不相信有可能用
staplelty
这样做。 However, you can just draw the staple as a horizontal line and add the vertical ticks. 但是,您可以将订书钉绘制为水平线并添加垂直刻度。
boxplot(iris[,1:4], outlty=1, pch="")
for(i in 1:4) {
segments(c(i-0.2,i+0.2), BP$stats[5,i], c(i-0.2,i+0.2), BP$stats[5,i] - 0.1)
segments(c(i-0.2,i+0.2), BP$stats[1,i], c(i-0.2,i+0.2), BP$stats[1,i] + 0.1)
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.