[R] How do you distinguish between characters on a pco plot?

Sarah Goslee sarah.goslee at gmail.com
Tue Apr 3 19:02:45 CEST 2012


You can pass a vector of colors to the col= argument,
eg
col=c(1, 1, 2, 3, 2, 1)
to match your parameters. Or, in your case,
c(rep("blue", 3), rep("red", 4), rep(2, "green"))
- untested because you didn't provide an example.

You should read ?par and ?plot

Unless you're using lattice graphics, but you don't tell us.

Sarah

On Tue, Apr 3, 2012 at 12:39 PM, leannehaggerty
<leannehaggerty at gmail.com> wrote:
> I've read everything I can find, maybe I'm just missing something but I can't
> find an example which colours the points on a pco plot differently based on
> user specified parameters, I can colour every point differently or all the
> same, or randomly with a number of colours.
> What I need to do is specify that points a, b and c, for example will be
> blue, while points d, e, f, and g will be red and points h and i will be
> green. Is it possible to colour with uneven distribution, I suppose is my
> question? I can't find a solution in any manual.
>
> --
-- 
Sarah Goslee
http://www.functionaldiversity.org



More information about the R-help mailing list