Categories &

Functions List

Function Reference: biplot

statistics: biplot (coefs)
statistics: biplot (coefs, name, value, …)
statistics: biplot (ax, …)
statistics: h = biplot (…)

Create a biplot of the coefficients in coefs.

biplot (coefs) plots the rows of coefs, typically the principal component coefficients returned by pca or pcacov or the factor loadings returned by factoran, as vectors from the origin. coefs has one row per observed variable and either two columns (for a 2-D biplot) or three columns (for a 3-D biplot).

The following name/value pairs are accepted:

"Scores"
A matrix of scores with the same number of columns as coefs (one row per observation). The scores are plotted as points, scaled to fit within the unit circle relative to the maximum coefficient length: each score is divided by the maximum absolute score value and multiplied by the length of the longest coefficient vector.
"VarLabels"
A character array or cell array of strings labeling each variable vector.
"ObsLabels"
A character array or cell array of strings labeling each observation.
"Positive"
If true, the reference axes are drawn only over the positive quadrant (2-D) or octant (3-D). The default is false.

Any additional name/value pairs are treated as line properties and applied to the variable vectors.

For readability the sign of each column of coefs is chosen so that its largest-magnitude element is positive; the same sign change is applied to the corresponding column of the scores.

biplot (ax, …) plots into the axes ax.

The optional output h is a column vector of handles to the plotted graphics objects, ordered as the variable vector lines, the variable markers, the variable text labels (if any), the observation markers, the observation text labels (if any), and finally the reference axis lines.

See also: pca, pcacov, factoran, rotatefactors

Source Code: biplot

Biplot of the first two principal components of Fisher's iris data.

 load fisheriris;
 [coefs, score] = pca (zscore (meas));
 biplot (coefs(:,1:2), "Scores", score(:,1:2), ...
         "VarLabels", {"SL", "SW", "PL", "PW"});
plotted figure

Three-component biplot of the same data.

 load fisheriris;
 coefs = pca (zscore (meas));
 biplot (coefs(:,1:3), "VarLabels", {"SL", "SW", "PL", "PW"});
plotted figure