Ich bin der R Anfänger und ich brauche Hilfe. Ich versuche, einen zweiten Plot zu einem in gap.barplot() erstellten Plot hinzuzufügen, aber fehlgeschlagen. Ich habe zwei Vektoren:Wie fügt man plot zu gap.barplot im plotrix-Paket hinzu?
y <- as.numeric(c(92, 8, 7,6,5))
z <- as.numeric(c(7.5, 5.9, 5.2, 4.5, 2.3))
die erste Plotten ist 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 = "")
Aber nachdem ich versuche, das gleiche mit dem zweiten Grundstück zu tun, smth schief geht :
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)
Ich sehe seltsame invertierte Handlung und die err oder Nachricht:
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)
Was mache ich falsch?
Vielen Dank im Voraus!
Danke, Cristoph! Ich habe diese Antwort selbst gefunden, aber das ist nicht das, was ich wollte: Es macht nicht wirklich Lücke in der Achse, macht nur eine Lücke aussehende Patch auf. (( –
@Aleks Zhang ich verstehe nicht. Siehe mein Beispiel oben. Was erwarten Sie dann? – Christoph