| pcaplot | R Documentation |
Plot function for PCA with grouped values.
pcaplot(x, y, scale = TRUE, pcs = 1:2, ...)
pca.plot(x, y, scale=TRUE, abbrev = FALSE, ep.plot=FALSE,...)
pca.comp(x, scale=FALSE, pcs=1:2,...)
x |
A matrix or data frame to be plotted. |
y |
A factor or vector giving group information of columns of
|
scale |
A logical value indicating whether the data set |
pcs |
A vector of index of PCs to be plotted. |
ep.plot |
A logical value indicating whether the ellipse should be plotted. |
abbrev |
Whether the group labels are abbreviated on the plots.
If |
... |
Further arguments to |
pcaplot returns an object of class "trellis".
pca.comp returns a list with components:
scores |
PCA scores |
vars |
Proportion of variance |
varsn |
A vector of string indicating the percentage of variance. |
Number of columns of x must be larger than 1. pcaplot uses
lattice to plot PCA while pca.plot uses the basic graphics
to do so. pca.plot plots PC1 and PC2 only.
Wanchang Lin
grpplot, panel.elli.1,
pca_plot_wrap
## examples of 'pcaplot'
data(iris)
pcaplot(iris[,1:4], iris[,5],pcs=c(2,1),ep=2)
## change confidence interval (see 'panel.elli.1')
pcaplot(iris[,1:4], iris[,5],pcs=c(1,2),ep=2, conf.level = 0.9)
pcaplot(iris[,1:4], iris[,5],pcs=c(2,1),ep=1,
auto.key=list(space="top", columns=3))
pcaplot(iris[,1:4], iris[,5],pcs=c(1,3,4))
tmp <- pcaplot(iris[,1:4], iris[,5],pcs=1:3,ep=2)
tmp
## change symbol's color, type and size
pcaplot(iris[,1:4], iris[,5],pcs=c(2,1),main="IRIS DATA", cex=1.2,
auto.key=list(space="right", col=c("black","blue","red"), cex=1.2),
par.settings = list(superpose.symbol = list(col=c("black","blue","red"),
pch=c(1:3))))
## compare pcaplot and pca.plot.
pcaplot(iris[,1:4], iris[,5],pcs=c(1,2),ep=2)
pca.plot(iris[,1:4], iris[,5], ep.plot = TRUE)
## an example of 'pca.comp'
pca.comp(iris[,1:4], scale = TRUE, pcs=1:3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.