poplin_biplot: Biplot of dimension-reduced data

Description Usage Arguments Value See Also Examples

View source: R/plot-biplot.R

Description

Visualize an overlay of a score plot and a loading plot using the poplin_reduce output.

Usage

 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
42
## Default S3 method:
poplin_biplot(
  x,
  y,
  comp = c(1, 2),
  group,
  group_col = NULL,
  point_size = 1.5,
  point_shape_by_group = FALSE,
  label = FALSE,
  label_size = 3.88,
  label_subset = NULL,
  ellipse = FALSE,
  xlab = NULL,
  ylab = NULL,
  title = NULL,
  legend = TRUE,
  arrow_len = 0.2,
  arrow_col = "red",
  arrow_alpha = 0.3,
  arrow_label = TRUE,
  arrow_label_ext = 1.1,
  arrow_label_size = 3.88,
  arrow_label_col = "red",
  arrow_label_subset = NULL,
  ...
)

## S3 method for class 'poplin.pca'
poplin_biplot(x, comp = c(1, 2), group, label = FALSE, ...)

## S3 method for class 'poplin.plsda'
poplin_biplot(
  x,
  comp = c(1, 2),
  group = attr(x, "Y.observed"),
  label = label,
  ...
)

## S3 method for class 'poplin'
poplin_biplot(x, xin, comp = c(1, 2), group, label = FALSE, ...)

Arguments

x

A dimension-reduced data matrix produced by poplin_reduce or poplin object containing dimension-reduced data.

y

A data matrix for loadings. Not required for the reduce_pca and reduce_plsda outputs.

comp

A numeric vector of length 2 indicating two components to plot.

group

A discrete variable to visualize the grouping structure.

group_col

A vector of colors with the same length of unique values in group.

point_size

Numeric controlling the size of points.

point_shape_by_group

Logical controlling whether each group have different shapes of data points. Also can be a numeric vector with the same length of unique values in group to manually set point shapes.

label

Logical controlling whether score labels are shown instead of points.

label_size

Numeric controlling the size of labels.

label_subset

A character vector specifying a subset of score labels to display.

ellipse

Logical controlling whether data ellipses are shown using the stat_ellipse (ggplot2 package).

xlab

The title of x-axis of the plot.

ylab

The title of y-axis of the plot.

title

The main title of the plot.

legend

Logical controlling whether the plot legend is shown.

arrow_len

Numeric controlling the length of arrow head.

arrow_col

Character indicating the color of arrows.

arrow_alpha

Numeric controlling the transparency of arrow.

arrow_label

Logical controlling whether text labels for arrows are shown.

arrow_label_ext

Numeric controlling the scalar extension for arrow labels.

arrow_label_size

Numeric value controlling the size of arrow labels.

arrow_label_col

Character indicating the color of arrow labels. labels.

arrow_label_subset

A character vector specifying a subset of arrow labels to display.

...

Arguments passed to the default method.

xin

Character specifying the name of data to retrieve from x when x is a poplin object

Value

A ggplot object.

See Also

poplin_reduce, poplin_scoreplot.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
data(faahko_poplin)

## sample group variable
group <- colData(faahko_poplin)$sample_group

## poplin object
poplin_biplot(faahko_poplin, xin = "pca", group = group)

## matrix
m <- poplin_reduced(faahko_poplin, "pca")
poplin_biplot(m, group = group, arrow_col = "orange",
              arrow_label_subset = rownames(faahko_poplin)[seq_len(10)])

jaehyunjoo/poplin documentation built on Jan. 8, 2022, 1:13 a.m.