poplin_scoreplot: Score plot of dimension-reduced data

Description Usage Arguments Value See Also Examples

View source: R/plot-scoreplot.R

Description

Visualize the data onto a lower-dimensional space 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
43
44
45
46
47
48
49
50
51
52
53
54
55
## Default S3 method:
poplin_scoreplot(
  x,
  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,
  ...
)

## S3 method for class 'poplin.pca'
poplin_scoreplot(
  x,
  comp = c(1, 2),
  group,
  group_col = NULL,
  label = FALSE,
  xlab = NULL,
  ylab = NULL,
  ...
)

## S3 method for class 'poplin.plsda'
poplin_scoreplot(
  x,
  comp = c(1, 2),
  group = attr(x, "Y.observed"),
  group_col = NULL,
  label = FALSE,
  xlab = NULL,
  ylab = NULL,
  ...
)

## S3 method for class 'poplin'
poplin_scoreplot(
  x,
  xin,
  comp = c(1, 2),
  group,
  group_col = NULL,
  label = FALSE,
  xlab = NULL,
  ylab = NULL,
  ...
)

Arguments

x

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

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 function from the 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.

...

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_biplot.

Examples

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

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

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

## matrix
m <- poplin_reduced(faahko_poplin, "pca")
poplin_scoreplot(m, group = group, label = TRUE)

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