Draw multiple bi-plots.
pairsplot(pcaobj,
components = getComponents(pcaobj, seq_len(5)),
triangle = TRUE,
trianglelabSize = 18,
plotaxes = TRUE,
margingaps = unit(c(0.1, 0.1, 0.1, 0.1), 'cm'),
ncol = NULL,
nrow = NULL,
x = NULL,
y = NULL,
colby = NULL,
colkey = NULL,
singlecol = NULL,
shape = NULL,
shapekey = NULL,
pointSize = 1.0,
legendPosition = 'none',
legendLabSize = 6,
legendIconSize = 1.5,
xlim = NULL,
ylim = NULL,
lab = NULL,
labSize = 1.5,
labhjust = 1.5,
labvjust = 0,
selectLab = NULL,
drawConnectors = FALSE,
widthConnectors = 0.5,
colConnectors = 'grey50',
xlab = NULL,
xlabAngle = 0,
xlabhjust = 0.5,
xlabvjust = 0.5,
ylab = NULL,
ylabAngle = 0,
ylabhjust = 0.5,
ylabvjust = 0.5,
axisLabSize = 10,
title = NULL,
titleLabSize = 32,
hline = NULL,
hlineType = 'longdash',
hlineCol = 'black',
hlineWidth = 0.4,
vline = NULL,
vlineType = 'longdash',
vlineCol = 'black',
vlineWidth = 0.4,
gridlines.major = TRUE,
gridlines.minor = TRUE,
borderWidth = 0.8,
borderColour = 'black',
returnPlot = TRUE)
Object of class 'pca' created by pca(). REQUIRED.
The principal components to be included in the plot. These will be compared in a pairwise fashion via multiple calls to biplot(). DEFAULT = getComponents(pcaobj, seq_len(5)). OPTIONAL.
Logical, indicating whether or not to draw the plots in the upper panel in a triangular arrangement? Principal component names will be labeled along the diagonal. DEFAULT = TRUE. OPTIONAL.
Size of p rincipal component label (when triangle = TRUE). DEFAULT = 18. OPTIONAL.
Logical, indicating whether or not to draw the axis tick, labels, and titles. DEFAULT = TRUE. OPTIONAL.
The margins between plots in the plot space. Takes the form of a 'unit()' variable. DEFAULT = unit(c(0.1, 0.1, 0.1, 0.1), 'cm'). OPTIONAL.
If triangle = FALSE, the number of columns in the final merged plot. DEFAULT = NULL. OPTIONAL.
If triangle = FALSE, the number of rows in the final merged plot. DEFAULT = NULL. OPTIONAL.
A principal component to plot on x-axis. All principal component names are stored in pcaobj$label. DEFAULT = NULL. OPTIONAL.
A principal component to plot on y-axis. All principal component names are stored in pcaobj$label. DEFAULT = NULL. OPTIONAL.
If NULL, all points will be coloured differently. If not NULL, value is assumed to be a column name in pcaobj$metadata relating to some grouping/categorical variable. DEFAULT = NULL. OPTIONAL.
Vector of name-value pairs relating to value passed to 'col', e.g., c(A='forestgreen', B='gold'). DEFAULT = NULL. OPTIONAL.
If specified, all points will be shaded by this colour. Overrides 'col'. DEFAULT = NULL. OPTIONAL.
If NULL, all points will be have the same shape. If not NULL, value is assumed to be a column name in pcaobj$metadata relating to some grouping/categorical variable. DEFAULT = NULL. OPTIONAL.
Vector of name-value pairs relating to value passed to 'shape', e.g., c(A=10, B=21). DEFAULT = NULL. OPTIONAL.
Size of plotted points. DEFAULT = 1.0. OPTIONAL.
Position of legend ('top', 'bottom', 'left', 'right', 'none'). DEFAULT = 'none'. OPTIONAL.
Size of plot legend text. DEFAULT = 6. OPTIONAL.
Size of plot legend icons / symbols. DEFAULT = 1.5. OPTIONAL.
Limits of the x-axis. DEFAULT = NULL. OPTIONAL.
Limits of the y-axis. DEFAULT = NULL. OPTIONAL.
A vector containing labels to add to the plot. DEFAULT = NULL. OPTIONAL.
Size of labels. DEFAULT = 1.5. OPTIONAL.
Horizontal adjustment of label. DEFAULT = 1.5. OPTIONAL.
Vertical adjustment of label. DEFAULT = 0. OPTIONAL.
A vector containing a subset of lab to plot. DEFAULT = NULL. OPTIONAL.
Logical, indicating whether or not to connect plot labels to their corresponding points by line connectors. DEFAULT = FALSE. OPTIONAL.
Line width of connectors. DEFAULT = 0.5. OPTIONAL.
Line colour of connectors. DEFAULT = 'grey50'. OPTIONAL.
Label for x-axis. DEFAULT = NULL. OPTIONAL.
Rotation angle of x-axis labels. DEFAULT = 0. OPTIONAL.
Horizontal adjustment of x-axis labels. DEFAULT = 0.5. OPTIONAL.
Vertical adjustment of x-axis labels. DEFAULT = 0.5. OPTIONAL.
Label for y-axis. DEFAULT = NULL. OPTIONAL.
Rotation angle of y-axis labels. DEFAULT = 0. OPTIONAL.
Horizontal adjustment of y-axis labels. DEFAULT = 0.5. OPTIONAL.
Vertical adjustment of y-axis labels. DEFAULT = 0.5. OPTIONAL.
Size of x- and y-axis labels. DEFAULT = 10. OPTIONAL.
Plot title. DEFAULT = NULL. OPTIONAL.
Size of plot title. DEFAULT = 32. OPTIONAL.
Draw one or more horizontal lines passing through this/these values on y-axis. For single values, only a single numerical value is necessary. For multiple lines, pass these as a vector, e.g., c(60,90). DEFAULT = NULL. OPTIONAL.
Line type for hline ('blank', 'solid', 'dashed', 'dotted', 'dotdash', 'longdash', 'twodash'). DEFAULT = 'longdash'. OPTIONAL.
Colour of hline. DEFAULT = 'black'. OPTIONAL.
Width of hline. DEFAULT = 0.4. OPTIONAL.
Draw one or more vertical lines passing through this/these values on x-axis. For single values, only a single numerical value is necessary. For multiple lines, pass these as a vector, e.g., c(60,90). DEFAULT = NULL. OPTIONAL.
Line type for vline ('blank', 'solid', 'dashed', 'dotted', 'dotdash', 'longdash', 'twodash'). DEFAULT = 'longdash'. OPTIONAL.
Colour of vline. DEFAULT = 'black'. OPTIONAL.
Width of vline. DEFAULT = 0.4. OPTIONAL.
Logical, indicating whether or not to draw major gridlines. DEFAULT = TRUE. OPTIONAL.
Logical, indicating whether or not to draw minor gridlines. DEFAULT = TRUE. OPTIONAL.
Width of the border on the x and y axes. DEFAULT = 0.8. OPTIONAL.
Colour of the border on the x and y axes. DEFAULT = 'black'. OPTIONAL.
Logical, indicating whether or not to return the plot object. DEFAULT = TRUE. OPTIONAL.
A cowplot
object.
# NOT RUN {
options(scipen=10)
options(digits=6)
col <- 20
row <- 20000
mat1 <- matrix(
rexp(col*row, rate = 0.1),
ncol = col)
rownames(mat1) <- paste0('gene', 1:nrow(mat1))
colnames(mat1) <- paste0('sample', 1:ncol(mat1))
mat2 <- matrix(
rexp(col*row, rate = 0.1),
ncol = col)
rownames(mat2) <- paste0('gene', 1:nrow(mat2))
colnames(mat2) <- paste0('sample', (ncol(mat1)+1):(ncol(mat1)+ncol(mat2)))
mat <- cbind(mat1, mat2)
metadata <- data.frame(row.names = colnames(mat))
metadata$Group <- rep(NA, ncol(mat))
metadata$Group[seq(1,40,2)] <- 'A'
metadata$Group[seq(2,40,2)] <- 'B'
metadata$CRP <- sample.int(100, size=ncol(mat), replace=TRUE)
metadata$ESR <- sample.int(100, size=ncol(mat), replace=TRUE)
p <- pca(mat, metadata = metadata, removeVar = 0.1)
pairsplot(p, triangle = TRUE)
# }
Run the code above in your browser using DataLab