Вы можете использовать lines
и указать позицию x
, чтобы нарисовать значения x разными цветами:
x=rnorm(6000, 10, 4)
plot(x[1:2000], type = "l", xlim = c(0,6000), col = "green")
lines(x = 2000:4000, y = x[2000:4000], col = "red")
lines(x = 4000:6000, y = x[4000:6000], col = "blue")
![enter image description here](https://i.stack.imgur.com/pGJyP.png)