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

From: Pam Allen <allen_pam_at_hotmail.com>
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:

date=c(1:300)
flow=sin(2*pi/53*c(1:300))
levels=c(rep(c("high","med","low"),100)) data=cbind.data.frame(date, flow, levels) plot(data$date,data$flow,type="n")
library(plotrix)
color.scale.lines(data$date,data$flow,

  col=color.scale(data$flow,extremes=c("blue","red")))

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!

-Pam

--
View this message in context: http://r.789695.n4.nabble.com/Help-with-plotting-a-line-that-is-multicoloured-based-on-levels-of-a-factor-tp3385857p3412310.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
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 https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive