Description
Customised PCA score plots with the possibility to choose PCs, exporting to png and the possibility to add color or different plotting symbols according to variable.
Usage
plotPCA(pca, PC1 = 1, PC2 = 2, file, colVar, symbVar, main = "")
Value
A PCA score plot. Exported as png if `file` specified in function call.
Arguments
- pca
A `prcomp` object
- PC1
Principal component on x-axis
- PC2
Principal component on y-axis
- file
If specified provides the name of a png export file. Otherwise normal plot.
- colVar
Continuous variable for coloring observations (40 cuts)
- symbVar
Categorical/discrete variable for multiple plot symbols
- main
If provided provides a main title of the plot
Examples
Run this codedata("freelive2")
pca_object<-prcomp(XRVIP2)
plotPCA(pca_object)
Run the code above in your browser using DataLab