I've used the R packages DESeq2 and ggplot2 and the following code
vsd <- varianceStabilizingTransformation(dds)
data <- plotPCA(vsd, intgroup=c("condition"), returnData=TRUE)
percentVar <- round(100 * attr(data, "percentVar"))
plotPCA <- ggplot(data, aes(PC1, PC2, color=condition)) +
geom_point(size=3) +
xlab(paste0("PC1: ",percentVar[1],"% variance")) +
ylab(paste0("PC2: ",percentVar[2],"% variance")) +
geom_text(aes(label=names),hjust=0.25, vjust=-0.5, show_guide = F)
ggsave("PCA.pdf", plot = plotPCA)
to produce the following PCA plot:
I know the axes are the principal components but I am confused by the units displayed. I thought the axes of a PCA plot are unit-less. But then I did image search on Google for "PCA plot" and saw tons of plots displaying units on their axes. Does anyone know what is the meaning of these units?
+ coord_fixed()
at the end (well anywhere within) the building of the plot; a 1 unit change in the x axis should be the same shift in the y axis. The axis are unitless in that a point is not -40 "something", it is just -40, for example. The axis is not numberless of course. The values are derived from the formation of the principal components as orthogonal linear combinations of the variables in the data set. $\endgroup$ – Reinstate Monica - G. Simpson Feb 15 '15 at 19:46