如何创建带有晶须的箱形图?

时间:2018-11-13 12:06:21

标签: r boxplot errorbar

我创建了一个具有3个箱形图的图,但是其中的一个晶须没有显示。

Boxplot

如何让它们显示?

这是我的数据

  

第3类:5.055052 3.028838 3.423485 6.434745 6.396239 4.114418   3.687380 2.633139 7.356185 5.736677 4.462504 7.137034

     

第4类:4.738094 21.736701 6.716363 10.306583 4.757640 6.265024

我的代码如下:

boxplot(hvol.concentration,class.3, class.4, ylab="8-OHdG Concentration (ng/ml)", main="Boxplot Distribution of 8-OHdG", ylim=c(0,25), pch=16, names=c("Control", "NYHA III", "NYHA IV"))

1 个答案:

答案 0 :(得分:1)

boxplot(c(4.738094, 21.736701, 6.716363, 10.306583, 4.757640, 6.265024), plot = FALSE)$stats
##           [,1]
## [1,]  4.738094 <<== It's definitely there but the lower bound of the IQR is almost the same as min val
## [2,]  4.757640
## [3,]  6.490694
## [4,] 10.306583 <<== Upper bound of IQR == max val
## [5,] 10.306583

如果使绘图窗口更大,则网格大小将足以看到较低的IQR:

boxplot(
  c(4.738094, 21.736701, 6.716363, 10.306583, 4.757640, 6.265024),
  horizontal = TRUE
)

enter image description here