假设我们有以下代码生成随机数并绘制箱线图:
set.seed(1)
a=rchisq(1000,2)
boxplot(a,ylim=c(-5,15))
abline(h=(summary(a))[2]-1.5*IQR(a),col="red") # Wrong!
abline(h=1.5*IQR(a)+(summary(a))[5],col="red") # OK! The red line and upper extreme cover each other.
我们如何画一条穿过下限的线?