Plot PCA Results

Usage

"plot"(x, pc.axes=NULL, pch=16, col=par("col"), cex=0.8, mar=c(4, 4, 1, 1),...)
"plot"(x, y = NULL, type = "o", pch = 18, main = "", sub = "", xlim = c(0, 20), ylim = NULL, ylab = "Proporton of Variance (%)", xlab = "Eigenvalue Rank", axes = TRUE, ann = par("ann"), col = par("col"), lab = TRUE, ...) "plot"(x, inds=NULL, col=rainbow(nrow(x)), lab = "", ...)

Arguments

x
the results of principal component analysis obtained with pca.xyz.
pc.axes
an optional numeric vector of length two specifying the principal components to be plotted. A NULL value will result in an overview plot of the first three PCs and a scree plot. See examples.
pch
a vector of plotting characters or symbols: see ‘points’.
col
a character vector of plotting colors.
cex
a numerical single element vector giving the amount by which plotting text and symbols should be magnified relative to the default.
mar
A numerical vector of the form c(bottom, left, top, right) which gives the number of lines of margin to be specified on the four sides of the plot.
inds
row indices of the conformers to label.
lab
a character vector of plot labels.
y
the y coordinates for the scree plot.
type
one-character string giving the type of plot desired.
main
a main title for the plot, see also 'title'.
sub
a sub-title for the plot.
xlim
the x limits of the plot.
ylim
the y limits of the plot.
ylab
a label for the y axis.
xlab
a label for the x axis.
axes
a logical value indicating whether both axes should be drawn.
ann
a logical value indicating whether the default annotation (title and x and y axis labels) should appear on the plot.
...
extra plotting arguments.

Description

Produces a z-score plot (conformer plot) and an eigen spectrum plot (scree plot).

Details

plot.pca is a wrapper calling both plot.pca.score and plot.pca.scree resulting in a 2x2 plot with three score plots and one scree plot.

Value

Produces a plot of PCA results in the active graphics device and invisibly returns the plotted ‘z’ coordinates along the requested ‘pc.axes’. See examples section where these coordinates are used to identify plotted points.

References

Grant, B.J. et al. (2006) Bioinformatics 22, 2695--2696.

Examples

attach(transducin)
The following objects are masked from transducin (pos = 3): annotation, core, pdbs
pc.xray <- pca(pdbs$xyz, rm.gaps=TRUE)
NOTE: Removing 49 gap positions with missing coordinate data retaining 305 non-gap positions for analysis.
plot(pc.xray) ## Color plot by nucleotide state vcolors <- annotation[, "color"]

plot(pc.xray, col=vcolors)

## Focus on a single plot of PC1 vs PC2 x <- plot(pc.xray, pc.axes=1:2, col=vcolors)
## Identify points interactively with mouse clicks #identify(x, labels=basename.pdb(pdbs$id)) ## Add labels to select points inds <- c(1,10,37) text(x[inds,], labels=basename.pdb(pdbs$id[inds]), col="blue")

## Alternative labeling method #labs <- rownames(annotation) #inds <- c(2,7) #plot.pca.score(pc.xray, inds=inds, col=vcolors, lab=labs) ## color by seq identity groupings #ide <- seqidentity(pdbs$ali) #hc <- hclust(as.dist(1-ide)) #grps <- cutree(hc, h=0.2) #vcolors <- rainbow(max(grps))[grps] #plot.pca.score(pc.xray, inds=inds, col=vcolors, lab=labs) detach(transducin)

See also

pca.xyz, plot.bio3d

Author

Barry Grant