例如,我只有Y的数据:
55.64
79.21
47.8
28.52
43.99
83.02
87.04
85.44
但是我想用这些数据绘制阴影区域,这可能吗?
答案 0 :(得分:1)
我不确定你想要实现什么,但这里有一种方法可以为Y
定义的线下的区域着色(假设相应的x值是1到length(Y)
) ,无论是纯色还是阴影线:
par(mfrow=c(1, 2))
# plain color (grey)
plot(seq(Y), Y, type="l", main="plain color")
polygon(c(1, seq(Y), length(Y)), c(0, Y, 0), col="grey")
# shading lines
plot(seq(Y), Y, type="l", main="shading lines")
polygon(c(1, seq(Y), length(Y)), c(0, Y, 0), density=10)