Skip to content
Prev 293790 / 398503 Next

How to plot PCA output?

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: