View source: R/pcair_S3methods.R
plot.pcair | R Documentation |
plot.pcair
is used to plot pairs of principal components contained in a class 'pcair
' object obtained as output from the pcair
function.
## S3 method for class 'pcair'
plot(x, vx = 1, vy = 2, pch = NULL, col = NULL,
xlim = NULL, ylim = NULL, main = NULL, sub = NULL,
xlab = NULL, ylab = NULL, ...)
x |
An object of class ' |
vx |
An integer indicating which principal component to plot on the x-axis; the default is 1. |
vy |
An integer indicating which principal component to plot on the y-axis; the default is 2. |
pch |
Either an integer specifying a symbol or a single character to be used in plotting points. If |
col |
A specification for the plotting color for points. If |
xlim |
The range of values shown on the x-axis. If |
ylim |
The range of values shown on the y-axis. If |
main |
An overall title for the plot. If |
sub |
A sub title for the plot. If |
xlab |
A title for the x-axis. If |
ylab |
A title for the y-axis. If |
... |
Other parameters to be passsed through to plotting functions, (see |
This function provides a quick and easy way to plot principal components obtained with the function pcair
to visualize the population structure captured by PC-AiR.
A figure showing the selected principal components plotted against each other.
Matthew P. Conomos
pcair
for obtaining principal components that capture population structure in the presence of relatedness.
par
for more in depth descriptions of plotting parameters.
The generic function plot
.
# file path to GDS file
gdsfile <- system.file("extdata", "HapMap_ASW_MXL_geno.gds", package="GENESIS")
# read in GDS data
HapMap_geno <- gdsfmt::openfn.gds(gdsfile)
# load saved matrix of KING-robust estimates
data("HapMap_ASW_MXL_KINGmat")
# run PC-AiR
mypcair <- pcair(HapMap_geno, kinobj = HapMap_ASW_MXL_KINGmat,
divobj = HapMap_ASW_MXL_KINGmat)
# plot top 2 PCs
plot(mypcair)
# plot PCs 3 and 4
plot(mypcair, vx = 3, vy = 4)
gdsfmt::closefn.gds(HapMap_geno)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.