Learn R Programming

iCheck (version 1.2.0)

pca2DPlot: Scatter plot of first 2 principal components

Description

Scatter plot of first 2 principal components.

Usage

pca2DPlot(pcaObj, plot.dim = c(1,2), labelVariable = "subjID", hybName = "Hybridization_Name", outFileName = "test_pca_raw.pdf", title = "Scatter plot of pcas", plotOutPutFlag = FALSE, mar = c(5, 4, 4, 2) + 0.1, lwd = 1.5, equalRange = TRUE, xlab = NULL, ylab = NULL, xlim = NULL, ylim = NULL, cex.legend = 1.5, cex = 1.5, cex.lab = 1.5, cex.axis = 1.5, legendPosition = "topright", ...)

Arguments

pcaObj
An object returned by the function pca of the R package pcaMethods.
plot.dim
A vector of 2 positive-integer-value integer specifying which 2 pcas will be plot.
labelVariable
The name of a column of the phenotype data matrix. The elements of the column will replace the column names of the expression data matrix.
hybName
character string. indicating the phenotype variable Hybridization_Name.
outFileName
Name of the figure file to be created.
title
Title of the scatter plot.
plotOutPutFlag
logical. plotOutPutFlag=TRUE indicates the plots will be output to pdf format files. Otherwise, the plots will not be output to external files.
mar
A numerical vector of the form 'c(bottom, left, top, right)' which gives the number of lines of margin to be specified on the four sides of the plot. The default is 'c(5, 4, 4, 2) + 0.1'. see par.
lwd
The line width, a _positive_ number, defaulting to '1'. see par.
equalRange
logical. Indicating if the x-axis and y-axis have the same range.
xlab
Label of x axis.
ylab
Label of y axis.
xlim
Range of x axis.
ylim
Range of y axis.
cex.legend
Font size for legend.
cex
numerical value giving the amount by which plotting text and symbols should be magnified relative to the default. see par.
cex.lab
The magnification to be used for x and y labels relative to the current setting of cex.
cex.axis
The magnification to be used for axis annotation relative to the current setting of cex.

see par.

legendPosition
Position of legend. Possible values are “bottomright”, “bottom”, “bottomleft”, “left”, “topleft”, “top”, “topright”, “right” and “center”.
...
Arguments to be passed to plot.

Value

A matrix of PCA scores. Each column corresponds to a principal component.

Examples

Run this code
    # generate simulated data set from conditional normal distribution
    set.seed(1234567)
    es.sim = genSimData.BayesNormal(nCpGs = 100, 
      nCases = 20, nControls = 20,
      mu.n = -2, mu.c = 2,
      d0 = 20, s02 = 0.64, s02.c = 1.5, testPara = "var",
      outlierFlag = FALSE, 
      eps = 1.0e-3, applier = lapply) 
    print(es.sim)

    pca.obj = getPCAFunc(es = es.sim, 
                     labelVariable = "subjID", 
                     hybName = "memSubj",
                     requireLog2 = FALSE,
                     corFlag = FALSE
)

pca2DPlot(pcaObj = pca.obj, 
          plot.dim = c(1,2),
          labelVariable = "subjID", 
          hybName = "memSubj",
          plotOutPutFlag = FALSE, 
          cex.legend = 0.5, 
          legendPosition = "topright") 
    

Run the code above in your browser using DataLab