chromaPlot: Chroma plot

Description Usage Arguments Details See Also Examples

View source: R/chromaPlot.R

Description

Produce a chroma plot from a full or partial PCADSC object, as obtained from a call to PCADSC. In either case, this PCADSC object must have a non-NULL chromaInfo slot (see examples). The chroma plot compares the loading patterns from PCA conducted on two datasets consisting of different observations of the same variables.

Usage

1
2
chromaPlot(x, varLabels = NULL, cvCO = 1, splitLabels = NULL,
  varAnnotation = "cum", useComps = NULL)

Arguments

x

Either a PCADSC object or a chromaInfo object, as produced by PCADSC and doChroma.

varLabels

A vector of character string labels for the variables used in pcadscObj. If non-NULL, these labels appear in the plot instead of the variable names.

cvCO

A numeric in the interval [0,1] where the default, 1, corresponds to no cut-off value. If a value smaller than 1, only the first n components are plotted, where n is the the lowest possible number, such that the cumulative variance contribution of the first n components exceeds cvCO for both datasets. Note that setting covCO will overrule the argument useComps.

splitLabels

Labels for the two categories of the splitting variable used to create the PCADSC object, x, given as a named list (see examples). These labels will appear in the headers of the two PCADSC plots. If NULL (the default), the original levels of the splitting variable are used.

varAnnotation

If "cum" (the default), cummulated explained variance percentages are annotated to the right of the bars for each component. If "raw", the non-cummulated percentages of explained variance are added instead. If NULL, no annotation is added. Note that "cum" is only allowed if useComps is non-NULL.

useComps

A vector of integers with the indexes of the principal component that should be included in the plot.

Details

The plot consists of one display for each of the two datasets. The two displays both consist of a number of vertical bars. Each vertical bar represents a principal component and the width of each colored section (chroma) within the bar corresponds to the normalized PCA loading vector of that component. The bars can be annotated with the (cumulative) variance contributions of the components (see varAnnotation).

See Also

PCADSC, doChroma

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#load iris data
data(iris)

#Define grouping variable, grouping the observations by whether their species is
#Setosa or not
iris$group <- "setosa"
iris$group[iris$Species != "setosa"] <- "non-setosa"
iris$Species <- NULL

## Not run: 
#make a PCADSC object, splitting the data by "group"
irisPCADSC <- PCADSC(iris, "group")

#make a partial PCADSC object from iris and fill out chromaInfo in the next call
irisPCADSC2 <- PCADSC(iris, "group", doChroma = FALSE)
irisPCADSC2 <- doChroma(irisPCADSC2)

#make a chroma plot
chromaPlot(irisPCADSC)
chromaPlot(irisPCADSC)

#Change the labels of the splitting variable
chromaPlot(irisPCADSC, splitLabels = list("non-setosa" = "Not Setosa",
    "setosa" = "Setosa"))

#Only plot components 1 and 4 and remove annotated variances
chromaPlot(irisPCADSC, useComps = c(1,4), varAnnotation = "no")

#Only plot the first components responsible for explaining 80 percent variance
chromaPlot(irisPCADSC, cvCO = 0.8)

#Change variable labels
chromaPlot(irisPCADSC, varLabels = c("Sepal length", "Sepal width", "Petal length",
   "Petal width"))

## End(Not run)

#Only do chroma information in order to get a faster runtime:
irisPCADSC_fast <- PCADSC(iris, "group", doCE = FALSE,
  doAngle = FALSE)
chromaPlot(irisPCADSC_fast)

PCADSC documentation built on May 2, 2019, 1:09 p.m.

Related to chromaPlot in PCADSC...