[R] How to plot PCA output?

Jessica Streicher j.streicher at micromata.de
Mon May 7 15:31:06 CEST 2012


To add: If thats not it, maybe you could be a bit more specific about what you consider the "result", and how you want it visualized.

Am 07.05.2012 um 15:24 schrieb Jessica Streicher:

> That depends on what you want to plot there. Basically, you could just use plot() with pcaResult$x. You might need to define which PCs you want to plot there though.
> 
> pcaResult<-prcomp(iris[,1:4])
> plot(pcaResult$x) # gives the first 2 PCs
> plot(pcaResult$x[,2:3]) #gives the second vs the 3rd PC
> 
> or if you want to see more you can use pairs()
> 
> pairs(pcaResult$x)
> 
> if you want things colored, theres the col parameter that works for both functions:
> 
> pairs(pcaResult$x,col=iris[,5])
> 
> Does this help?
> 
> Am 07.05.2012 um 12:22 schrieb Christian Cole:
> 
>> I have a decent sized matrix (36 x 11,000) that I have preformed a PCA on
>> with prcomp(), but due to the large number of variables I can't plot the
>> result with biplot(). How else can I plot the PCA output?
>> 
>> I tried posting this before, but got no responses so I'm trying again.
>> Surely this is a common problem, but  I can't find a solution with google?
>> 
>> 
>> The University of Dundee is a registered Scottish Charity, No: SC015096
>> 
>> ______________________________________________
>> 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.
> 
> ______________________________________________
> 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.



More information about the R-help mailing list