here is a simple approach to, for instance, plot scores for PC1 and
PC2 using diff colors:
scores <- prcomp(yourdata)$x
plot(scores[1:100,1], scores[1:100,2], pch = 20, col = "blue")
points(scores[101:200,1], scores[101:200,2], pch = 20, col = "red")
PM
On Sat, Sep 6, 2008 at 11:44 PM, pgseye <prseye at gmail.com>
wrote:>
> Hi,
>
> I'm wanting to do a PCA on some data which is comprised of two
different
> groups (to see how well the groups are discriminated). Is there a way to
> change the colour of the datapoints in a biplot so that I can easily see
> which group is which (eg objects 1-100, red, 101-200, black).
>
> Might be simple, but I'm new to R and can't seem to find how to do
this.
>
> Thanks.
>
> Paul
> --
> View this message in context:
http://www.nabble.com/Label-2-groups-in-PCA-different-colours-tp19354077p19354077.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.
>