[BioC] PCA score plot

James W. MacDonald jmacdon at med.umich.edu
Wed Feb 28 21:17:38 CET 2007


James Anderson wrote:
> Hi,
> 
> I am trying to plot the score plot of the first 2 PCs. I used the
> following commands for plotting:
> 
> plot(PCA, main="PCA" ) 
> colors=c(rep("red",10), rep("green",10)) 
> text(PCA,labels =' ',col = colors )
> 
> However, in the text command line, if I use the above command, it
> only plots those points without any colors. What I wanna plot is that
> the first 10 samples plotted in blue squares, the other 10 samples
> plotted in magenta dots, how to do this?

Assuming PCA is a data.frame or matrix holding your data, you probably 
want to reverse things.

colors <- rep(c("red","green"), each = 10)
plot(PCA, main="PCA", pch = rep(15:16, each = 10), col = colors)

HTH,

Jim


> 
> Thanks,
> 
> James
> 
> 
> 
> 
> 
> 
> 
> ---------------------------------
> 
> [[alternative HTML version deleted]]
> 
> _______________________________________________ Bioconductor mailing
> list Bioconductor at stat.math.ethz.ch 
> https://stat.ethz.ch/mailman/listinfo/bioconductor Search the
> archives:
> http://news.gmane.org/gmane.science.biology.informatics.conductor


-- 
James W. MacDonald, M.S.
Biostatistician
Affymetrix and cDNA Microarray Core
University of Michigan Cancer Center
1500 E. Medical Center Drive
7410 CCGC
Ann Arbor MI 48109
734-647-5623


**********************************************************
Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues.



More information about the Bioconductor mailing list