DrawScores: Scores plots

Description Usage Arguments Details Value Examples

View source: R/DrawScores.R

Description

Draws scores plots for the SVDforPCA, PLSDA or OPLSDA functions.

Usage

1
2
3
4
DrawScores(obj, type.obj = c("PCA", "PLSDA", "OPLSDA"), drawNames = TRUE,
  createWindow = FALSE, main = NULL, color = NULL, pch = NULL,
  size = 1, cex.lab = 3, axes = c(1, 2), xlab = NULL, ylab = NULL,
  drawEllipses = FALSE, typeEl = "norm", levelEl = 0.9)

Arguments

obj

The objects resulting from a PCA, PLSDA or OPLSDA analysis.

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.

color

Optional character, factor or numeric vector giving the color of the observations.

pch

Optional character, factor or numeric vector giving the pch of the observations.

size

The points size.

cex.lab

The size of points labels.

axes

Numerical vector indicating the PC axes that are drawn. Only the two first values are considered for scores plot. See details#' @param num.stacked Number of stacked plots if type is 'loadings'.

xlab

Label for the x-axis.

ylab

Label for the y-axis.

drawEllipses

If TRUE, will draw ellipses with the ggplot2::stat_ellipse with groups coresponding to the color vector.

typeEl

The type of ellipse, either "norm" (multivariate normal distribution), "t" (multivariate t-distribution) and "euclid" draws a circle with the radius equal to level, representing the euclidean distance from the center.

levelEl

The confidence level at which to draw an ellipse.

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
data('iris')
PCA.res = SVDforPCA(iris[,1:4])
class = iris[,5]

DrawScores(PCA.res, drawNames=TRUE, type.obj = 'PCA',
createWindow=FALSE, main = 'PCA score plot for Iris dataset',
  color = class, axes =c(1,2))

ManonMartin/PAMMULAD documentation built on May 23, 2019, 9 p.m.