Learn R Programming

mixOmics (version 5.2.0)

plotArrow: Arrow sample plot

Description

Represents samples from multiple coordinates.

Usage

plotArrow(  object,
            comp = NULL,
            abline.line = FALSE,
            xlim = NULL,
            ylim = NULL,
            group=NULL,
            col,
            cex,
            pch,
            main=NULL,
            plot.arrows=TRUE,
            add.legend=FALSE,
            X.label = NULL,
            Y.label = NULL,
            ind.names=FALSE,
            position.names='centroid'
  )

Arguments

object
object of class inheriting from mixOmics: PLS, sPLS, rCC, rGCCA, sGCCA, sGCCDA
comp
integer vector of length two indicating the components represented on the horizontal and the vertical axis to project the individuals.
abline.line
should the vertical and horizontal line through the center be plotted? Default set to FALSE
xlim
the ranges to be encompassed by the $x$ axis, if NULL they are computed.
ylim
the ranges to be encompassed by the $y$ axis, if NULL they are computed.
group
factor indicating the group membership for each sample. Coded as default for the supervised method sGCCDA, sPLSDA, but needs to be input for the unsupervised methods PLS, sPLS, rCC, rGCCA, sGCCA
col
character (or symbol) color to be used, color vector also possible.
cex
numeric character (or symbol) expansion, , color vector also possible.
pch
plot character. A character string or a vector of single characters or integers. See points for all alternatives.
main
set of characters for the title plot.
plot.arrows
boolean. Whether arrows should be added or not. Default is TRUE.
add.legend
boolean. Whether the legend should be added. Only for the supervised methods and if group!=NULL. Default is FALSE.
X.label
x axis titles.
Y.label
y axis titles.
ind.names
If TRUE, the row names of the first (or second) data matrix are used as sample names (see Details). Can be a vector of length the sample size to display sample names.
position.names
One of "centroid", "start", "end". Define where sample names are plotted when ind.names=TRUE. In a multiblock analysis, centroid and start will display similarly.

encoding

latin1

Details

Graphical of the samples (individuals) is displayed in a superimposed manner where each sample will be indicated using an arrow. The start of the arrow indicates the location of the sample in $X$ in one plot, and the tip the location of the sample in $Y$ in the other plot.

For objects of class "GCCA" and if there are more than 3 blocks, the start of the arrow indicates the centroid between all data sets for a given individual and the tips of the arrows the location of that individual in each block.

Short arrows indicate a strong agreement between the matching data sets, long arrows a disagreement between the matching data sets.

References

Le Cao, K.-A., Martin, P.G.P., Robert-Granie, C. and Besse, P. (2009). Sparse canonical methods for biological data integration: application to a cross-platform study. BMC Bioinformatics 10:34.

See Also

arrows, text, points and http://mixOmics.org/graphics for more details.

Examples

Run this code
## plot 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)

plotArrow(nutri.res)

# names indicate genotype
plotArrow(nutri.res,
group = nutrimouse$genotype, ind.names = nutrimouse$genotype)

plotArrow(nutri.res, group = nutrimouse$genotype,
add.legend = TRUE)



## plot 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))

#default
plotArrow(toxicity.spls)

# colors indicate time of necropsy, text is the dose
plotArrow(toxicity.spls,  group = liver.toxicity$treatment[, 'Time.Group'],
ind.names  = liver.toxicity$treatment[, 'Dose.Group'],
add.legend = TRUE)

# colors indicate time of necropsy, text is the dose, label at start of arrow
plotArrow(toxicity.spls,  group = liver.toxicity$treatment[, 'Time.Group'],
ind.names  = liver.toxicity$treatment[, 'Dose.Group'],
add.legend = TRUE, position.names = 'start')

## variable representation for objects of class 'sgcca' (or 'rgcca')
# ----------------------------------------------------
data(nutrimouse)
Y = unmap(nutrimouse$diet)
data = list(gene = nutrimouse$gene, lipid = nutrimouse$lipid, Y = Y)
design1 = matrix(c(0,1,1,1,0,1,1,1,0), ncol = 3, nrow = 3, byrow = TRUE)
nutrimouse.sgcca <- wrapper.sgcca(blocks = data,
design = design1,
penalty = c(0.3, 0.5, 1),
ncomp = c(2, 2, 3),
scheme = "centroid",
verbose = FALSE,
bias = FALSE)

# default style: same color for all samples
plotArrow(nutrimouse.sgcca)

plotArrow(nutrimouse.sgcca, group = nutrimouse$diet, add.legend =TRUE,
main = 'my plot')

# ind.names to visualise the unique individuals
plotArrow(nutrimouse.sgcca, group = nutrimouse$diet, add.legend =TRUE,
main = 'my plot', ind.names = TRUE)

# ind.names to visualise the unique individuals
plotArrow(nutrimouse.sgcca, group = nutrimouse$diet, add.legend =TRUE,
main = 'my plot', ind.names = TRUE,position.names   = 'start')

plotArrow(nutrimouse.sgcca, group = nutrimouse$diet, add.legend =TRUE,
main = 'my plot', ind.names = TRUE,position.names   = 'end')

# ind.names indicates the diet
plotArrow(nutrimouse.sgcca, group = nutrimouse$diet, add.legend =TRUE,
main = 'my plot', ind.names = nutrimouse$diet, position.names= 'start')

# ind.names to visualise the unique individuals, start position
plotArrow(nutrimouse.sgcca, group = nutrimouse$diet, add.legend =TRUE,
main = 'my plot', ind.names = TRUE, position.names   = 'start')

# end position
plotArrow(nutrimouse.sgcca, group = nutrimouse$diet, add.legend =TRUE,
main = 'my plot', ind.names = TRUE, position.names   = 'end')


## variable representation for objects of class 'sgccda'
# ----------------------------------------------------
# Note: the code differs from above as we use a 'supervised' GCCA analysis
data(nutrimouse)
Y = nutrimouse$diet
data = list(gene = nutrimouse$gene, lipid = nutrimouse$lipid)
design1 = matrix(c(0,1,0,1), ncol = 2, nrow = 2, byrow = TRUE)

nutrimouse.sgccda1 <- wrapper.sgccda(blocks = data,
Y = Y,
design = design1,
ncomp = c(2, 2),
keep = list(c(10,10), c(15,15)),
scheme = "centroid",
verbose = FALSE,
bias = FALSE)


#  default colors correspond to outcome Y
plotArrow(nutrimouse.sgccda1)

# with legend and title and indiv ID
plotArrow(nutrimouse.sgccda1,  add.legend = TRUE, main = 'my sample plot',
ind.names = TRUE, position.names = 'start')

Run the code above in your browser using DataLab