DrawSL: Scores and Loadings plots

Description Usage Arguments Details Value Examples

View source: R/DrawSL.R

Description

Draws scores and Loadings plots for PCA analysis derived from the SVDforPCA function.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
DrawSL(
  obj,
  type.obj = c("PCA", "PLSDA", "OPLSDA"),
  drawNames = TRUE,
  createWindow = FALSE,
  main = NULL,
  class = NULL,
  axes = c(1, 2),
  type.graph = c("scores", "loadings"),
  loadingstype = c("l", "p", "s"),
  num.stacked = 4,
  xlab = NULL,
  ylab = NULL,
  ang = 0,
  xaxis = c("numerical", "character"),
  nxaxis = 10
)

Arguments

obj

The objects resulting from a PCA analysis with the SVDforPCA function.

type.obj

The type of object to be plotted.

drawNames

If TRUE, will show the observations names on the Scores plot.

createWindow

If TRUE, will create a new window for the plot.

main

Plot title. If NULL, default title is provided.

class

Optional character or numeric vector giving the class of the observations.

axes

Numerical vector indicating the PC axes that are drawn. Only the two first values are considered for scores plot. See details

type.graph

The type of plot, either 'scores' or 'loadings'

loadingstype

The type of Loadings plot, either a line plot ('l'), points ('p') or segments ('s').

num.stacked

Number of stacked plots if type is 'loadings'.

xlab

Label for the x-axis.

ylab

Label for the y-axis.

ang

Angle to rotate the x axis labels for a better visualisation.

xaxis

Specify if the xaxis is numerical or character

nxaxis

Number of thick marks on the xaxis for a character x variable

Details

If type.obj is 'OPLSDA', axes = 1 represents the predictive score vector, axes = 2 represents the first orthogonal score vector, etc.

Value

A score or loading plot in the current device.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
data('HumanSerum')
res.PCA = SVDforPCA(HumanSerumSpectra)
class = ClassHS

DrawSL(res.PCA, drawNames=TRUE, type.obj = 'PCA',
createWindow=FALSE, main = 'PCA score plot for HumanSerum dataset',
  class = class, axes =c(1,2), type.graph ='scores')

DrawSL(res.PCA, drawNames=TRUE, type.obj = 'PCA',
createWindow=FALSE, main = 'PCA loadings plot for HumanSerum dataset',
   axes = 1, type.graph ='loadings', loadingstype='l')

ManonMartin/MBXUCL documentation built on Nov. 26, 2021, 8:45 p.m.