I'm the R novice and I need some help. I'm trying to add second plot to one created in gap.barplot(), but failing. I have two vectors:
y <- as.numeric(c(92, 8, 7,6,5))
z <- as.numeric(c(7.5, 5.9, 5.2, 4.5, 2.3))
Plotting the first one is ok:
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 = "")
But after I'm trying to do the same with the second plot, smth goes wrong:
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)
I see strange inverted plot and the error message:
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)
What am I doing wrong?
Thanks in advance!