Learn R Programming

mixOmics (version 5.0-4)

plot3dIndiv: Plot of Individuals (Experimental Units) in three dimensions

Description

This function provides scatter plots of individuals (experimental units) in three dimensions for (r)CCA, (s)PLS regression and PCA.

Usage

## S3 method for class 'rcc':
plot3dIndiv(object, comp = 1:3, ind.names = FALSE,
            rep.space = "XY-variate",
            xlab = NULL, ylab = NULL, zlab = NULL,
            col = "blue", cex = 1, pch = "s", font = 1,
            axes.box = "box", \ldots)
	  
## S3 method for class 'pls':
plot3dIndiv(object, comp = 1:3, ind.names = FALSE,
            rep.space = "X-variate",
            xlab = NULL, ylab = NULL, zlab = NULL,
            col = "blue", cex = 1, pch = "s", font = 1,
            axes.box = "box", \ldots)

## S3 method for class 'splsda': plot3dIndiv(object, comp = 1:3, ind.names = FALSE, rep.space = "X-variate", xlab = NULL, ylab = NULL, zlab = NULL, col = "blue", cex = 1, pch = "s", font = 1, axes.box = "box", \ldots)

## S3 method for class 'plsda': plot3dIndiv(object, comp = 1:3, ind.names = FALSE, rep.space = "X-variate", xlab = NULL, ylab = NULL, zlab = NULL, col = "blue", cex = 1, pch = "s", font = 1, axes.box = "box", \ldots)

## S3 method for class 'spls': plot3dIndiv(object, comp = 1:3, ind.names = FALSE, rep.space = "X-variate", xlab = NULL, ylab = NULL, zlab = NULL, col = "blue", cex = 1, pch = "s", font = 1, axes.box = "box", \ldots)

## S3 method for class 'pca': plot3dIndiv(object, comp = 1:3, ind.names = FALSE, xlab = NULL, ylab = NULL, zlab = NULL, col = "blue", cex = 1, pch = "s", font = 1, axes.box = "box", \ldots)

## S3 method for class 'spca': plot3dIndiv(object, comp = 1:3, ind.names = FALSE, xlab = NULL, ylab = NULL, zlab = NULL, col = "blue", cex = 1, pch = "s", font = 1, axes.box = "box", \ldots)

Arguments

object
object of class inheriting from "rcc", "pls", "plsda", "spls", "plsda" or "pca".
comp
an integer vector of length 3, the components that will be used on the $x$-axis, the y-axis and z-axis respectively to project the individuals.
ind.names
either a character vector of names for the individuals to be plotted, or FALSE for no names. If TRUE, the row names of the first (or second) data matrix is used as names (see Details).
rep.space
character string, (partially) matching one of "X-variate", "Y-variate" or "XY-variate", determining the subspace to project the individuals. Defaults to "XY-variate" and "X-variate"
xlab, ylab, zlab
x, y and z axis titles.
col
character (or item) color to be used, possibly vector (see Details).
cex
numeric character (or item) expansion, possibly vector (see Details).
pch
character indicating the type of item to plot, possibly vector (see Details).
font
character font to be used, possibly vector (see Details).
axes.box
character string specifying the axes box type. Should be a of c("box", "bbox", "both").
...
further title parameters are passed to title3d.

encoding

latin1

Details

plot3dIndiv method makes scatter plot for individuals representation in three dimensions. Each item corresponds to an individual.

If ind.names=TRUE and row names is NULL, then ind.names=1:n, where n is the number of individuals.

The arguments col, cex, pch and font can be atomic vectors or vectors of length n. If atomic, this argument value determines the graphical attribute for all the individuals. In the last case, multiple arguments values can be specified so that each item (individual) can be given its own graphic attributes. Default values exist for this arguments. Supported types for pch are: "s" for spheres, "t" for tetrahedrons, "c" for cubes, "o" for octahedrons, "i" for icosahedrons and "d" dodecahedrons.

The pointing device of your graphics user-interface can also be used to set the viewpoint interactively. With the pointing device the buttons are by default set as follows: - left adjust viewpoint position - middle adjust field of view angle - right or wheel adjust zoom factor

See Also

plotIndiv, plot3dVar, text3d, title3d and rgl.postscript to save the screen shot to a file in PostScript or other vector graphics format (provided you load the rgl library.

Examples

Run this code
require(rgl)

## plot3d of individuals for objects of class 'rcc' 
data(nutrimouse)
X <- nutrimouse$lipid
Y <- nutrimouse$gene
nutri.res <- rcc(X, Y, ncomp = 3, lambda1 = 0.064, lambda2 = 0.008)

col = nutrimouse$diet
font = c(rep(1, 20), rep(3, 20))
plot3dIndiv(nutri.res, ind.names = nutrimouse$diet, 
                axes.box = "box", font = font, col = col)
				
pch = c(rep("s", 20), rep("t", 20))
plot3dIndiv(nutri.res, ind.names = FALSE, axes.box = "both", 
                col = col, cex = 1.5, pch = pch)

## plot3d of individuals for objects of class 'pls' or 'spls'	   
data(liver.toxicity)
X <- liver.toxicity$gene
Y <- liver.toxicity$clinic
toxicity.spls <- spls(X, Y, ncomp = 3, keepX = c(50, 50, 50), 
                      keepY = c(10, 10, 10))
		  	
Time.Group = liver.toxicity$treatment[, "Time.Group"]				  
col <- rep(c("blue", "red", "darkgreen", "darkviolet"), rep(16, 4))
plot3dIndiv(toxicity.spls, ind.names = Time.Group, 
                 col = col, cex = 0.8)		  
		  				  
col <- rainbow(48)[Time.Group]
plot3dIndiv(toxicity.spls, ind.names = FALSE, 
                 col = col, cex = 0.3, axes.box = "both")	

## plot3d of individuals for objects of class 'pca'	   
data(multidrug)
pca.res <- pca(multidrug$ABC.trans, ncomp = 4, scale = TRUE)

palette(rainbow(9))
col = as.numeric(as.factor(multidrug$cell.line$Class))
plot3dIndiv(pca.res, cex = 0.25, col = col)
palette("default")

Run the code above in your browser using DataLab