Re: [R] Help with plotting a line that is multicoloured based on levels of a factor

From: Pam Allen <>
Date: Mon, 28 Mar 2011 09:33:26 -0700 (PDT)

Thank you Jim and David for your help.

The 'levels' call is not a misdirection, in my actual dataset it is necessary because the flows aren't symmetrical. So while your solution is quite elegant David, it doesn't apply to my actual data, just the example. Too bad, it's quite nice!

I do think that "color.scale.lines" can work, now I just need to figure out how! Unfortunately when I tried your example Jim:

levels=c(rep(c("high","med","low"),100)), flow, levels) plot(data$date,data$flow,type="n")


I got this error:
"Error in length(redrange) : 'redrange' is missing"

But I do think the function is the way to go for my dataset.

Thank you!


View this message in context:
Sent from the R help mailing list archive at

______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Mon 28 Mar 2011 - 19:29:10 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 29 Mar 2011 - 02:20:25 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive