[R] How to plot PCA output?

Christian Cole C.Cole at dundee.ac.uk
Mon May 7 16:01:40 CEST 2012


Hi Jessica,

Yes, that does help. It confirms my digging around in the prcomp object.

I was plotting $x, but wasn't sure whether this was appropriate. Mainly
because the data ranges are different in $x than when plotted by biplot()
- as I mentioned my reply to Bryan. Do you know if this difference is data
range matters?
Many thanks,

Chris



On 07/05/2012 14:24, "Jessica Streicher" <j.streicher at micromata.de> wrote:

>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.
>


The University of Dundee is a registered Scottish Charity, No: SC015096



More information about the R-help mailing list