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

Judith Flores juryef at yahoo.com
Tue Feb 26 22:34:28 CET 2008


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



More information about the R-help mailing list