# What are the four axes on PCA biplot?

When you construct a biplot for a PCA analysis, you have principal component PC1 scores on the x-axis and PC2 scores on the y-axis. But what are the other two axes to the right and the top of the screen?

• How can we know which screen are you talking about? – FairMiles Aug 21 '13 at 22:44
• @ttnphns had an excellent answer here – Haitao Du Jun 17 '16 at 13:53

Do you mean, e.g., in the plot that the following command returns?

biplot(prcomp(USArrests, scale = TRUE))


If yes, then the top and the right axes are meant to be used for interpreting the red arrows (points depicting the variables) in the plot.

If you know how the principal component analysis works, and you can read R code, the code below shows you how the results from prcomp() are initially treated by biplot.prcomp() before the final plotting by biplot.default(). These two functions are called in the background when you plot with biplot(), and the following modified code excerpt is from biplot.prcomp().

x<-prcomp(USArrests, scale=TRUE)
choices = 1L:2L
scale = 1
pc.biplot = FALSE
scores<-x$x lam <- x$sdev[choices]
n <- NROW(scores)
lam <- lam * sqrt(n)
lam <- lam^scale
yy<-t(t(x$rotation[, choices]) * lam) xx<-t(t(scores[, choices])/lam) biplot(xx,yy)  Shortly, in the example above, the the matrix of variable loadings (x$rotation) is scaled by the standard deviation of the principal components (x$sdev) times square root of the number of observations. This sets the scale for the top and right axes to what is seen on the plot. There are other methods to scale the variable loadings, also. These are offered e.g. by the R package vegan. • +1. I took the liberty to insert the figure into your answer. – amoeba says Reinstate Monica Jan 14 '15 at 18:03 • In addition, I think it would be very useful for future references, if you could add to your answer that PC scores (axes on the left and in the bottom) are scaled to unit sum-of-squares: they are not "raw" PC scores. – amoeba says Reinstate Monica Jan 14 '15 at 18:16 • Further in addition, one should say that the arrows are plotted such that the center of the text label is where it should be! The arrows are then multiplied by$0.8$before plotting, i.e. all the arrows are shorter than what they should be, presumably to prevent overlapping with the text label (see code for biplot.default). I find this is extremely confusing. – amoeba says Reinstate Monica Mar 19 '15 at 10:06 • Even further in addition, see also this later thread: Positioning the arrows on a PCA biplot. – amoeba says Reinstate Monica Apr 6 '15 at 22:12 I have a better visualization for the biplot. Please check following figure. In the experiment, I am trying to mapping 3d points into 2d (simulated data set). The trick to understand biplot in 2d is finding the correct angle to see same thing in 3d. All the data points are numbered, you can see the mapping clearly. Here is the code to reproduce the results. require(rgl) set.seed(0) feature1=round(rnorm(50)*10+20) feature2=round(rnorm(50)*10+30) feature3=round(runif(50)*feature1) d=data.frame(feature1,feature2,feature3) head(d) plot(feature1,feature2) plot(feature2,feature3) plot(feature1,feature3) plot3d(d$feature1, d$feature2, d$feature3, type = 'n')
points3d(d$feature1, d$feature2, d\$feature3, color = 'red', size = 10)
shift <- matrix(c(-2, 2, 0), 12, 3, byrow = TRUE)
text3d(d+shift,texts=1:50)
grid3d(c("x", "y", "z"))

pr.out=prcomp(d,scale.=T)
biplot(pr.out)
grid()

• +1. However, note that in your rotated 3D figure the cloud of dots has the variance preserved (horizontal projection, i.e. PC1, has larger variance than the vertical one, i.e. PC2) whereas the red arrows all have unit length (in 3D). This is not the case in the biplot produced by the biplot command in R and reproduced in your figure on the right side: there the cloud of dots is standardized but the arrows have lengths corresponding to the variances. – amoeba says Reinstate Monica Jun 14 '16 at 20:28
• @amoeba good point. I just draw the arrows manually and forgot the length of the arrow also have specific meanings. – Haitao Du Jun 14 '16 at 20:36
• I think your manual 3D/2D "biplot" corresponds more to what the function biplot produces with scale=0 argument. – amoeba says Reinstate Monica Jun 14 '16 at 21:23