On Thu, 26 Feb 2004, David Thibault wrote:

> Hello all,
>
> I have a situation where I'd like to plot points from multiple groups of
> data in one plot.  I'd like each group's points to be colored a different
> color.  I've seen people comment on how you can alternate colors by
> providing a range of colors and then it will loop through each color as it
> plots individual points.  However, that just goes by individual points and
> not by group.
>

Concatenate the groups into a single x vector and y vector, together with
a vector of group identifiers (eg  1,1,1,1,1,2,2,2,2,2,2,2,3,3), then

plot(y~x, col=group)

or to get more control

prettycolors<- c("forestgreen","goldenrod","sienna")

plot(y~x, col=prettycolors[group])

There are examples in demo(graphics).

        -thomas

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to