Plot matrix-like object by group
grpplot(x, y, plot = "pairs", ...)
An object of class "trellis"
.
A matrix or data frame to be plotted.
A factor or vector giving group information of columns of x
.
One of plot types: strip
, box
, density
and
pairs
.
Further arguments. See corresponding entry in
xyplot
for non-trivial details. One argument is
ep
: an integer for plotting ellipse. 1
and
2
for plotting overall and group ellipse, respectively.
Otherwise, none. For details, see panel.elli.1
.
Wanchang Lin
panel.elli.1
, pcaplot
,
pca_plot_wrap
, lda_plot_wrap
,
pls_plot_wrap
.
data(iris)
grpplot(iris[,1:4], iris[,5],plot="strip", main="IRIS DATA")
grpplot(iris[,1:4], iris[,5],plot="box", main="IRIS DATA")
grpplot(iris[,1:4], iris[,5],plot="density", main="IRIS DATA")
grpplot(iris[,1:4], iris[,5],plot="pairs",main="IRIS DATA",ep=2)
## returns an object of class "trellis".
tmp <- grpplot(iris[,c(2,1)], iris[,5],main="IRIS DATA",ep=2)
tmp
## change symbol's color, type and size
grpplot(iris[,c(2,1)], iris[,5],main="IRIS DATA", cex=1.5,
auto.key=list(space="right", col=c("black","blue","red")),
par.settings = list(superpose.symbol = list(col=c("black","blue","red"),
pch=c(1:3))))
Run the code above in your browser using DataLab