If you save the barplot()
result as an object you get the midpoints for the bars.
bp <- barplot(y)
bp
[,1]
[1,] 0.7
[2,] 1.9
[3,] 3.1
[4,] 4.3
[5,] 5.5
If you use them now in other plotting functions those midpoints should be as x
values. In call plot(bp)
they are used as y
values and x
values are sequence numbers 1,2,3,4,5
- so they do not correspond to midpoints.
Providing also y
values, points are plotted as expected.
bp <- barplot(y)
points(bp,c(10,20,30,40,50))
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…