Re: [R] Multiple lines with a different color assigned to each line

From: John Kane <jrkrideau_at_yahoo.ca>
Date: Tue, 26 Feb 2008 16:49:40 -0500 (EST)


I am not sure if I completely understand but would something like this work? (not tested)

points(.... col=i)
lines (.... col=i=1)

> Dear R-experts,
>
> I want to assign different colors to groups of
> points, lines and segments in a plot.
>
> I have a vector(dat$tx) that is going to have a
> different number of levels every time the user wants
> to plot a set of data. The number of lines is going
> to
> be equal to the number of levels of the vector
> mentioned.
>
> What I have so far is this:
>
> plot(1,1,type="n")
> for (i in dat$tx) {
>
>
> points(summ$timep[summ$tx==i],summ$mn[summ$tx==i])
> lines(summ$timep[summ$tx==i],summ$mn[summ$tx==i])
> }
>
> How can I assign different colors to the points and
> lines?
>
> Thank you in advance for any help,
>
> Judith
>
>
>
>



> Be a better friend, newshound, and
>
> ______________________________________________
> 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.
>

[[elided Yahoo spam]]



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 Tue 26 Feb 2008 - 22:02:20 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 26 Feb 2008 - 22:30:17 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