testVal <- matrix(rnorm(10000), nrow=500)
colnames(testVal) <- paste("Sample", 1:ncol(testVal), sep="")
rownames(testVal) <- paste("Gene",1:nrow(testVal), sep="")
testPCA <- prcomp(t(testVal), center=TRUE, scale=TRUE)
plotPCA(testPCA)
plotPCA(testPCA, points=FALSE, text=TRUE, grid=TRUE)
pointsList <- list(col=1:3, bg=21,pch=22, cex=4:1, lwd=1:2, lty=2:4)
textList <- list(col=c("orange", "royalblue"), cex=1.2, srt=15, pos=1)
plotPCA(testPCA, choices=c(1,2), grid=TRUE, points=pointsList,
text=TRUE)
## visualize dimension 1:3
rop <- par(mfrow=c(1,2), pty="s")
plotPCA(testPCA, choices=c(1,2), grid=TRUE, points=pointsList, text=textList)
plotPCA(testPCA, choices=c(2,3), grid=TRUE, points=pointsList, text=textList)
par(rop)
Run the code above in your browser using DataLab