plot_PC: Plot of principal components

Description Usage Arguments Value Functions Author(s) See Also Examples

Description

The plot of a pair of principal components is displayed for a matrix or a single BAf-class object. Colors or symbols of the points can be diffrentiated by the variable given in col_by or pch_by to assist to find hidden substructure of sample. The principal components were obtained by (prcomp) with scaling.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
plot_PC(x, pc = c(1, 2), main = "", xlab, ylab, ...)

## S4 method for signature 'prcomp'
plot_PC(x, pc = c(1, 2), main = "", xlab, ylab, ...)

## S4 method for signature 'matrix'
plot_PC(x, pc = c(1, 2), main = "", xlab, ylab, ...)

## S4 method for signature 'BAf'
plot_PC(
  x,
  pc = c(1, 2),
  main = "",
  xlab,
  ylab,
  ...,
  col_by = NULL,
  pch_by = NULL,
  legend_arg = list(x = "topright")
)

Arguments

x

an object of the prcomp, matrix or BAf-class

pc

a vector that consists of two integer elements for two principal components

main, xlab, ylab

same as plot.default

...

pass to plot

col_by, pch_by

a name of a column in sI(x). Different color / symbols the points will have.

legend_arg

a list of parameters to be used in adding a legend. If NULL, skip to add legend

Value

plot_PC prcomp output object

Functions

Author(s)

Mun-Gwan Hong mun-gwan.hong@scilifelab.se

See Also

prcomp

Examples

1
2
3
4
data(sba)
plot_PC(sba)
plot_PC(sba, col_by= "plate")    # no legend
plot_PC(sba, col_by= "plate", pch_by= "sex", legend_arg= list())

Rundmus/BAf-R_package documentation built on May 18, 2020, 12:59 p.m.