Description Usage Arguments Details See Also Examples
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.
1 2 | chromaPlot(x, varLabels = NULL, cvCO = 1, splitLabels = NULL,
varAnnotation = "cum", useComps = NULL)
|
x |
Either a |
varLabels |
A vector of character string labels for the variables used in
|
cvCO |
A numeric in the interval [0,1] where the default, |
splitLabels |
Labels for the two categories of the splitting variable used
to create the |
varAnnotation |
If |
useComps |
A vector of integers with the indexes of the principal component that should be included in the plot. |
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
).
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.