问题描述
用gplots::plotmeans()
画带置信区间的折线图时,出现警告“zero-length arrow is of indeterminate angle and so skipped”,请问原因是什么?应该如何解决呢?
代码和结果
代码如下。已知是否出现警告和选入的行有关,比如说测试前25行到28行作图(n=c(25:28))结果,发现在n=27和n=28的时候出现了该警告。
library(gplots)
mydata <- data.frame(
"id" = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
31, 32, 33, 34, 35),
"value" = c(0.406, 0.257, 25.828, 16.474, 3.127,
0.975, 1.569, 0.138, 0.094, 0.094,
0.094, 0.094, 0.094, 0.094, 18.948,
4.534, 0.184, 0.415, 0.6, 0.444, 0.235,
0.335, 1.324, 1.124, 1.625, 0.952,
0.232, 0.108, 1.773, 0.323, 0.35,
0.322, 0.136, 0.232, 0.511),
"group" = c("B", "B", "B", "B", "A", "A", "A", "A", "A", "A",
"A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
"A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
"A", "A", "B", "B", "B"))
for (n in c(25:28)) {
plotmeans(head(mydata$value, n) ~ head(mydata$group, n), main = paste0("n=", n))
}
警告的具体内容为:
## Warning in arrows(x, li, x, pmax(y - gap, li), col = barcol, lwd = lwd, : zero-
## length arrow is of indeterminate angle and so skipped
但并不是跟总行数有关,比如测试n=33就没什么问题:
plotmeans(head(mydata$value, 33) ~ head(mydata$group, 33), main = paste0("n=", 33))
可能和数据本身组成有关?至少知道这个警告是什么意思,可能对解决问题有帮助。