Learn R Programming

mixOmics (version 4.1-4)

plot3dVar: Plot of Variables in three dimensions

Description

This function provides variables representation in three dimensions for (regularized) CCA, (sparse) PLS regression and PCA.

Usage

## S3 method for class 'rcc':
plot3dVar(object, comp = 1:3, rad.in = 1, 
          cutoff = NULL, X.label = FALSE, Y.label = FALSE, 
          pch = NULL, cex = NULL, col = NULL, font = NULL,
          axes.box = "all", label.axes.box = "both",		
          xlab = NULL, ylab = NULL, zlab = NULL, \ldots)

## S3 method for class 'pls':
plot3dVar(object, comp = 1:3, rad.in = 1, 
          X.label = FALSE, Y.label = FALSE,
          pch = NULL, cex = NULL, col = NULL, font = NULL, 
          axes.box = "all", label.axes.box = "both",		
          xlab = NULL, ylab = NULL, zlab = NULL, \ldots)

## S3 method for class 'spls':
plot3dVar(object, comp = 1:3, rad.in = 1, 
          X.label = FALSE, Y.label = FALSE,
          pch = NULL, cex = NULL, col = NULL, font = NULL, 
          axes.box = "all", label.axes.box = "both",		
          xlab = NULL, ylab = NULL, zlab = NULL, \ldots)

## S3 method for class 'plsda':
plot3dVar(object, comp = 1:3, rad.in = 1, 
          var.label = FALSE, 
          pch = NULL, cex = NULL, col = NULL, font = NULL, 
          axes.box = "all", label.axes.box = "both",		
          xlab = NULL, ylab = NULL, zlab = NULL, \ldots)

## S3 method for class 'splsda':
plot3dVar(object, comp = 1:3, rad.in = 1, 
          var.label = FALSE, 
          pch = NULL, cex = NULL, col = NULL, font = NULL, 
          axes.box = "all", label.axes.box = "both",		
          xlab = NULL, ylab = NULL, zlab = NULL, \ldots)	 
		  
## S3 method for class 'pca':
plot3dVar(object, comp = 1:3, rad.in = 1, 
	      var.label = FALSE,
          pch = NULL, cex = NULL, col = NULL, font = NULL, 
          axes.box = "all", label.axes.box = "both",		
          xlab = NULL, ylab = NULL, zlab = NULL, \ldots)

## S3 method for class 'spca':
plot3dVar(object, comp = 1:3, rad.in = 1, 
          var.label = FALSE, 
          pch = NULL, cex = NULL, col = NULL, font = NULL, 
          axes.box = "all", label.axes.box = "both",		
          xlab = NULL, ylab = NULL, zlab = NULL, \ldots)

Arguments

object
object of class inheriting from "rcc", "pls", "plsda", "spls", "plsda", "pca" or "spca".
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 variables.
rad.in
numeric between 0 and 1, the radius of the small sphere. Defaults to 1.
cutoff
numeric between 0 and 1. Variables with correlations below this cutoff in absolute value are not plotted (see Details).
X.label, Y.label, var.label
either a character vector of names for the variables or FALSE for no names. If TRUE, the columns names of the matrice are used as labels.
col
character or integer vector of colors for plotted character and items. See Details.
pch
character indicating the type of item to plot, possibly vector (see Details).
cex
numeric character (or item) expansion (see Details).
font
numeric font to be used. See text3d for details.
axes.box
character string or vector specifying the axes box type. Should be a subset of c("axes", "box", "bbox", "all").
label.axes.box
character string indicating whether to label the axes and/or boxes. Should be a of c("axes", "box", "both")
xlab, ylab, zlab
$x$-, $y$- and $z$-axis titles.
...
further title parameters are passed to title3d.

Value

  • A list containing the following components:
  • coord.Xmatrix of $X$-variables coordinates.
  • coord.Ymatrix of $Y$-variables coordinates.

encoding

latin1

Details

plot3dVar gives an extension of the "correlation circle" to three dimensions, i.e. the correlations between each variable and the selected components are plotted as scatter plot in three dimensions. For the objects of class rcc, pls and spls a sphere of radius given by rad.in centred in the origin is displayed. If cutoff is not NULL the rad.in is ignored and the radius of the sphere is equal to cutoff. For plsda and splsda objects, only the $X$ variables are represented. For spls and splsda objects, only the $X$ and $Y$ variables selected on dimensions comp are represented. The arguments cex, pch and font are vectors of length two for the objects of class rcc, pls and spls. The firts and second component value determines the graphical attribute for $X$- and $Y$-variables respectively. 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 argument col can be either a vector of length two or a list with two vector components of length $p$ and $q$ respectively, where $p$ is the number of $X$-variables and $q$ is the number of $Y$-variables. In the first case, the first and second component of the vector determine the color for the $X$- and $Y$-variables respectively. Otherwise, multiple colors can be specified so that each item (variable) can be given its own color. In this case, the first component of the list correspond to the $X$-color attribut and the second component correspond to the $Y$-color attribute. 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

plotVar, plot3dIndiv, text3d, title3d and rgl.postscript to save the screen shot to a file in PostScript or other vector graphics format.

Examples

Run this code
require(rgl)

## 3D variable representation 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)

# default
plot3dVar(nutri.res)

# cutoff active, labeling the variables
plot3dVar(nutri.res, cutoff = 0.7, X.label = TRUE, cex = c(0.8, 0.8))

## 3D variable representation for objects of class 'pls' or 'spls'
data(liver.toxicity)
X <- liver.toxicity$gene
Y <- liver.toxicity$clinic
toxi.spls.1 <- spls(X, Y, ncomp = 3, keepX = c(50, 50, 50), 
                    keepY = c(10, 10, 10))
        
plot3dVar(toxi.spls.1, rad.in = 0.5, keep.var = TRUE, cex = c(1, 0.8), 
          main = "Variables 3D representation") 

toxi.spls.2 <- spls(X, Y, ncomp = 3, keepX = c(10, 10, 10), 
                    keepY = c(10, 10, 10))
					  
plot3dVar(toxi.spls.2, rad.in = 0.5, Y.label = TRUE, 
          main = "Variables 3D representation", 
          label.axes.box = "axes")
	
## 3D variable representation for objects of class 'pca'	   
data(multidrug)
pca.res <- pca(multidrug$ABC.trans, ncomp = 4, scale = TRUE)

plot3dVar(pca.res)

## variable representation for objects of class 'splsda'
data(liver.toxicity)
X <- liver.toxicity$gene
Y <- as.factor(liver.toxicity$treatment[, 4])

ncomp <- 3
keepX <- rep(20, ncomp)

splsda.liver <- splsda(X, Y, ncomp = ncomp, keepX = keepX)
plot3dVar(splsda.liver, var.label = FALSE, Y.label = TRUE, keep.var = TRUE)

Run the code above in your browser using DataLab