我是 R 新手,我需要一些帮助。我正在尝试将第二个图添加到在 gap.barplot() 中创建的图,但失败了。我有两个向量:
y <- as.numeric(c(92, 8, 7,6,5))
z <- as.numeric(c(7.5, 5.9, 5.2, 4.5, 2.3))
绘制第一个是可以的:
gap.barplot(y,
gap = c(9, 80),
ytics=c(2,4,6,8,90,92),
col=rep("lightsalmon", 5),
xaxt = "n",
ylab = "Frequencies, n",
xlab = "")
但是在我尝试对第二个情节做同样的事情之后,smth 出错了:
gap.barplot(z,
gap = c(9, 80),
ytics=c(2,4,6,8,90,92),
col=rep("green", 5),
xaxt = "n",
ylab = "Frequencies, n",
xlab = "",
main = "Colors",
add = T)
我看到奇怪的倒置图和错误消息:
Error in rect(xtics[bigones] - halfwidth, botgap, xtics[bigones] + halfwidth, :
не могу смешивать координаты нулевой длины с ненулевыми (can not mix the coordinates of length zero with non-zero)
In addition: Warning messages:
1: In plot.window(...) : "add" -- не графический параметр (not graphics option)
2: In plot.xy(xy, type, ...) : "add" -- не графический параметр (not graphics option)
3: In title(...) : "add" -- не графический параметр (not graphics option)
4: In axis(1, at = xtics, labels = xaxlab, ...) :
"add" -- не графический параметр (not graphics option)
5: In axis(2, at = c(ytics[littletics], ytics[bigtics] - gapsize), :
"add" -- не графический параметр (not graphics option)
我究竟做错了什么?
提前致谢!