[R] Plot Principal component analysis
SNN
s.nancy1 at yahoo.com
Fri Feb 29 04:47:57 CET 2008
Thanks for your help.
I downloaded the scatterplot3d package.
plot3d(pr$x, col = c("red", "blue")[c(rep(1, 100), rep(2, 15))], pch=20)
where pr$x is the object of the PCA. this works but the graph does not look
good.
the other option that I tried is
scatterplot3d(pr$x, type="p", highlight.3d=T, pch=16) where the graph looks
much nicer but i do not know how to have each group with a different color.
Does anyone know how to do it?
SNN wrote:
>
> Hi,
>
> I have matrix of 300,000*115 (snps*individual). I ran the PCA on the
> covariance matrix which has a dimention oof 115*115. I have the first 100
> individuals from group A and the rest of 15 individuals from group B. I
> need to plot the data in two and 3 dimentions with respect to PC1 and PC2
> and (in 3D with respect to PC1, PC2 and PC3). I do not know how to have
> the plot ploting the first 100 points corresponding to group A in red (for
> example) and the rest of the 15 points in Blue? i.e I want the each group
> in a diffrent color in the same plot. I appreciate if someone can help.
>
> Thanks,
>
--
View this message in context: http://www.nabble.com/Plot-Principal-component-analysis-tp15700123p15751493.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list