Skip to content
Prev 138259 / 398503 Next

Plot using colors

You want just the points with colors?

var <- rnorm(10)
vars <- rnorm(10)

plot(var, type='l')
points(var, col=ifelse(var < vars, 'green', 'red'), pch= 16)

or

the lines also?

for(i in 1:9)segments(i, var[i], i + 1, var[i+1], ifelse(var[i] <
vars[i], 'green', 'red'))
On 03/03/2008, mysimbaa <adel.tekari at sisltd.ch> wrote: