plot.pca {labdsv} | R Documentation |
A set of routines for plotting, highlighting points, or adding fitted surfaces to PCAs.
## S3 method for class 'pca': plot(x, ax = 1, ay = 2, col = 1, title = "", pch = 1, ...) ## S3 method for class 'pca': points(x, which, ax = 1, ay = 2, col = 2, pch = 1, ...) ## S3 method for class 'pca': plotid(ord, ids = seq(1:nrow(ord$scores)), ax = 1, ay = 2, col = 1, ...) ## S3 method for class 'pca': hilight(ord, factor, ax = 1, ay = 2, ...) ## S3 method for class 'pca': surf(ord, var, ax = 1, ay = 2, col = 2, labcex = 0.8, family = gaussian, ...) ## S3 method for class 'pca': jsurf(ord, var, ax = 1, ay = 2, col = 2, labcex = 0.8, family = gaussian, ...) varplot.pca(x, dim = length(x$sdev))
x |
an object of class ‘pca’ |
ax |
the dimension to use for the X axis |
ay |
the dimension to use for the Y axis |
title |
a title for the plot |
which |
a logical variable to specify points to be highlighted |
ord |
an object of class ‘pca’ |
factor |
a factor or integer vector |
var |
a variable to be surfaced |
family |
controls the link function passed to ‘gam’: one of ‘gaussian’, ‘binomial’, or ‘poisson’ |
ids |
identifier labels for samples. Defaults to 1:n |
dim |
number of dimensions to include in barplot |
col |
color index for points or contours |
pch |
plot character: glyph |
labcex |
character size for contour labels |
... |
arguments to pass to underlying functions |
Function ‘plot’ produces a scatterplot of sample scores for the specified axes, erasing or over-plotting on the current graphic device. Axes dimensions are controlled to produce a graph with the correct aspect ratio. Functions ‘points’, ‘plotid’, sQuote{hilight}, ‘surf’, and ‘jsurf’ add detail to an existing plot. The axes specified must match the underlying plot exactly.
Function ‘plotid’ identifies and labels samples (optionally with values from a third vector) in the PCO, and requires interaction with the mouse: left button identifies, right button exits.
Function ‘points’ is passed a logical vector to identify a set of samples by color of glyph. It can be used to identify a single set meeting almost any criterion that can be stated as a logical expression.
Function ‘hilight’ is passed a factor vector or integer vector, and identifies identifies factor values by color and glyph.
Functions ‘surf’ and ‘jsurf’ calculate and plot fitted
surfaces for logical or quantitative
variables; ‘jsurf’ jitters the coordinates to avoid problems with
identical values in fitting the surface. The functions are simply
wrappers for the gam
function, and send the
sample coordinates and the ‘var’ variable
to ‘gam’ to model. The coordinates and the fitted values from
‘gam’ are then passed to interp
, which plots the
contours. The default link function for fitting the GAMs is sQuote{gaussian},
suitable for unbounded continuous variables. For logical variables you
should specify ‘family = binomial’ to get a logistic GAM, and
for integer counts you should specify ‘family = poisson’ to get
a Poisson GAM.
Function ‘varplot.pca’ produces two plots: (1) the variance accounted for by eigenvector up to the specified number of dimensions (default = all), and (2) the cumulative variance accounted for by dimension.
Function ‘plotid’ returns a vector of row numbers of identified plots
David W. Roberts droberts@montana.edu http://ecology.msu.montana.edu/labdsv
points
, plotid
,
hilight
,
surf
, and jsurf
data(bryceveg) data(brycesite) pca.1 <- pca(bryceveg) plot(pca.1) points(pca.1,brycesite$elev>8000) surf(pca.1,brycesite$elev) ## Not run: plotid(pca.1,ids=row.names(bryceveg))