立即学习:https://edu.csdn.net/course/play/24913/285855?utm_source=blogtoedu
ploygon函数在图上加上多边形
polygon(x,y,…)
以数据(x,y)为坐标,依次连接所有的点,绘出一个多边形
x = 1:10
y = rnorm(x)
x1 = c(2, 4, 4)
y1 = c(0, 0, 1)
plot(x, y, type = 'l')
polygon(x1, y1, col = 'red')
对应结果: