| PLOT | R Documentation |
Various maps and biplots of the results of the functions LRA, PCA or CA.
Groups of rows can be optionally defined with colours and/or symbols.
PLOT(obj, classobj, map="symmetric", rescale=1, dim=c(1,2), axes.inv = c(1,1), main="",
most=FALSE, arrows=TRUE, cols=c("blue","red"), colarrows = "pink", cexs=c(0.8,0.8),
fonts=c(2,4), group=NA, groupnames=NA, groupcols=NA, grouppchs=NA, legendpos=NA,
ellipse=NA, ellipse.sup=FALSE, conf=0.95, labelrows=TRUE)
obj |
An LRA, PCA or CA object created using the respective functions |
classobj |
"LRA", "PCA" or "CA", or the class is picked up from the object itself |
map |
Choice of scaling of rows and columns: |
rescale |
A rescaling factor applied to column coordinates (default is 1 for no rescaling) |
dim |
Dimensions selected for horizontal and vertical axes of the plot (default is c(1,2)) |
axes.inv |
Option for reversing directions of horizontal and vertical axes (default is c(1,1) for no reversing, change one or both to -1 for reversing) |
main |
Title for plot |
most |
Whether to limit the plotted variables to those with more than average contributions (default is FALSE) |
arrows |
To plot biplot arrows or not (default is TRUE) |
cols |
Colours for row and column labels (default is c("blue","red")) |
colarrows |
Colour for arrows in asymmetric and contribution biplots (default is "pink") |
cexs |
Character expansion factors for row and column labels (default is c(0.8,0.8)) |
fonts |
Fonts for row and column labels (default is c(2,4)) |
group |
Grouping variable for samples (rows); a numeric variable as long as number of rows |
groupnames |
Group names |
groupcols |
Group colours |
grouppchs |
Group symbols |
legendpos |
Position of legend: "topleft","topright","bottomleft","bottomright", default NA |
ellipse |
Set to optional type of ellipse (only if rows are grouped) – see |
ellipse.sup |
A logical flag indicating whether confidence ellipses should be calculated and drawn exclusively on the supplementary row points (default is |
conf |
Confidence level for optional confidence ellipses (defaul=0.95) |
labelrows |
Use row labels (default=TRUE); if FALSE then use proposed symbols |
The function PLOT makes a scatterplot of the results of a logratio analysis (computed using function LRA), or a principal component analysis (computed using function
PCA), or a correspondence analysis (computed using function CA). It includes the following options: colouring groups of row (sample) points, with optional symbols; adding a legend; and confidence ellipses using the function CIplot_biv for the two-dimensional group means By default, dimensions 1 and 2 are plotted on the horizontal and vertical axes.
By default, the symmetric scaling is used, where both rows and columns are in principal coordinates and have the same amount of weighted variance along the two dimensions. The other options are the asymmetric option, when columns are in standard coordinates, and the contribution option, when columns are in contribution coordinates. In cases where the row and column displays occupy widely different extents, the column coordinates can be rescaled using the rescale option.
Michael Greenacre
Greenacre, M. (2013), Contribution biplots, Journal of Computational and Graphical Statistics, 22, 107-122. Greenacre, M. (2016), Data reporting and visualization in ecology, Polar Biology, 39, 2189-2205.
CIplot_biv
# perform LRA on the fish data and define four sex-habitat groups for colouring
data(FishMorphology)
sex <- FishMorphology[,1]
habitat <- FishMorphology[,2]
fish <- as.matrix(FishMorphology[,4:29])
# Convert to compositional data matrix
fish <- CLOSE(fish)
# Compute logarithm of mass and interaction of sex (F/M) and habitat (L/P) categories
sexhab <- 2*(sex-1)+habitat
sexhab.names <- c("FL","FP","ML","MP")
rownames(fish) <- sexhab.names[sexhab]
# Correspondence analysis
fish.ca <- CA(fish)
PLOT(fish.ca, map="contribution", rescale=0.1, axes.inv=c(1,1), cexs=c(0.6,0.8),
group=sexhab, groupcols=c("forestgreen","forestgreen","chocolate","chocolate"),
groupnames=sexhab.names, ellipse=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.