• Examples
Examples

Example: APOD and PSAP; If they meet each other at 90°, they are not likely to be correlated. Example: NPC2 and GBA. When they diverge and form a large angle (close to 180°), they are negative correlated. Example: NPC2 and MAG. Now that you know all that, reading a PCA biplot is a piece of cake. PCA biplot = PCA score plot + loading plot. A biplot is plot which aims to represent both the observations and variables of a matrix of multivariate data on the same plot. There are many variations on biplots (see the references) and perhaps the most widely used one is implemented by biplot.princomp.The function biplot.default merely provides the underlying code to plot two sets of variables on the same figure.


R Biplot Pca Example

  1. 2 BiplotGUI: Interactive Biplots in R 1.1. Biplots Introduced byGabriel(1971), the biplot is described byGower and Hand(1996) in their authoritative monograph as the multivariate analogue of the ordinary scatter plot. As such, biplots are representations of multivariate data in which information on both the samples.
  2. Dear R-help fellows good afternoon. I am struggling in the attempt to impose some graphical conditions (changing point symbols, colors, etc) to biplot function (I am using it to visualize the results of princomp) but I can't apparently manage to change anything but the axis. And I have been browsing manuals and vignettes without finding any explicit suggestions on how to operate.
  3. An implementation of the biplot using ggplot2. The package provides two functions: ggscreeplot and ggbiplot. Ggbiplot aims to be a drop-in replacement for the built-in R function biplot.princomp with extended functionality for labeling groups, drawing a correlation circle, and adding Normal probability ellipsoids.
R Biplot Example

The function fviz_pca_biplot() can be used to plot a biplot of individuals and variables from the output of several PCA functions : the function PCA() from FactoMineR package; prcomp() and princomp() from stats package; dudi.pca() from ade4 package.

The package devtools is required for the installation as factoextra is hosted on github.

R Biplot Example

Load factoextra :

R Biplot Example Csv

  • X : an object of class PCA (FactoMineR); prcomp (stats); princomp (stats); dudi and pca (ade4).
  • axes : a numeric vector of length 2 specifying the components to be plotted.
  • geom : a character specifying the geometry to be used for the graph. Allowed values are “point” (to show only points), “text” to show only labels or c(“point”, “text”) to show both types.
  • label : a character vector specifying the elements to be labelled. Default value is “all”. Allowed values are “none” or the combination of c(“ind”, “ind.sup”, “quali”, “var”, “quanti.sup”). “ind” can be used to label only active individuals. “ind.sup” is for supplementary individuals. “quali” is for supplementary qualitative variables. “var” is for active variables. “quanti.sup” is for quantitative supplementary variables.
  • invisible : a character value specifying the elements to be hidden on the plot. Default value is “none”. Allowed values are the combination of c(“ind”, “ind.sup”, “quali”, “var”, “quanti.sup”).
  • labelsize : font size for the labels
  • habillage : an optional factor variable for coloring the observations by groups. Default value is “none”. If X is an PCA object from FactoMineR package, habillage can also specify the supplementary qualitative variable (by its index or name) to be used for coloring individuals by groups (see ?PCA in FactoMineR).
  • addEllipses : logical value. If TRUE, draws ellipses around the individuals when habillage != “none”.
  • ellipse.level : the size of the concentration ellipse in normal probability
  • col.ind, col.var : color for individuals and variables, respectively. Possible values include also : “cos2”, “contrib”, “coord”, “x” or “y”. In this case, the colors for individuals/variables are automatically controlled by their qualities (“cos2”), contributions (“contrib”), coordinates (x^2+y2, “coord”), x values(“x”) or y values(“y”). To use automatic coloring (by cos2, contrib, ….), make sure that habillage =“none”.
  • col.ind.sup : color for supplementary individuals
  • alpha.ind, alpha.var : controls the transparency of individual and variable colors, respectively. The value can variate from 0 (total transparency) to 1 (no transparency). Default value is 1. Possible values include also : “cos2”, “contrib”, “coord”, “x” or “y”. In this case, the transparency for individuals/variables colors are automatically controlled by their qualities (“cos2”), contributions (“contrib”), coordinates (x^2+y2, “coord”), x values(“x”) or y values(“y”). To use this, make sure that habillage =“none”.

Principal component analysis

R Biplot Example

A principal component analysis (PCA) is performed using the built-in R function princomp() and iris data

R Biplot Examples

Biplot of individuals and variables

Note that, in the R code below, the argument data is required only when res.pca is an object of class prcomp or princomp. In others word, it can be omitted when the PCA is performed using FactoMineR or ade4.

Change the color of individuals by groups

the argument habillage is used to specify the factor variable for coloring the observations by groups :

Add ellipses of point concentrations :

This analysis has been performed using R software (ver. 3.1.2) and factoextra (ver. 1.0.0)

The BiplotGUI package homepage

The BiplotGUI package for R makes it easy to construct and interact with biplots.

Biplots

Biplots can be interpreted as graphs in which observations are represented as points while, simultaneously, variables are represented as calibrated biplot axes. Such representations make it easy to visualise multivariate data in two or three dimensions. The biplots of the BiplotGUI package are based on the book by Gower and Hand (1996) and can be thought of as multivariate analogues of the ordinary scatter plot.

Features

  • A graphical user interface (GUI), making the package easy to use.
  • Support for different types of biplots (PCA, covariance/correlation, CVA, regression, Procrustes, circular non-linear), both predictive and interpolative.
  • Support for different scaling techniques (PCO, metric MDS, non-metric MDS, semi-metric MDS).
  • Various data transformations and distance metrics.
  • Additional descriptors (convex hulls, alpha-bags, point densities, classification regions).
  • Diagnostics (graphs of convergence; point, group and axis predictivities; Shepard diagrams).
  • Interactivity (variable value prediction, zooming, point and axis drag-and-drop, 3D biplots).
  • The package is free and open-source.

Requirements

  • R needs to be installed. R 2.10.1 can be downloaded from CRAN .

Installation

  • To install the BiplotGUI package and all its dependencies from within R, the following command can be entered at the prompt of the R console: install.packages('BiplotGUI').
  • Alternatively, BiplotGUI version 0.0-6 can be downloaded from CRAN, and installed manually. The package dependencies (colorspace ,deldir, KernSmooth, MASS, rgl, tcltk, tcltk2, tkrplot) also need to be installed.

Vignette

Screenshots

Examples

Click here for help, to report bugs, or to download the developement version of the package.

Other biplot packages in R

The calibrations of the calibrate package correspond to those of Gower and Hand (1996), and therefore with those of the BiplotGUI package for linear biplots.

Author

Anthony la Grange

References

Gower JC and Hand DJ (1996). Biplots. Monographs on Statistics and Applied Probability. London, UK: Chapman & Hall.

License

Permission is granted to copy, distributed and/or modify the code of the BiplotGUI package under the terms of the GNU Public License, Version 3 or any later version published by the Free Software Foundation .

Last updated: 14 February 2010