Plots the scatter of two components of a sPLS-DA, as generated by perform.sPLSDA.

plot.sPLSDA.scatter(
  DEprot.sPLSDA.object,
  comp.x = 1,
  comp.y = 2,
  color.column = NULL,
  shape.column = NULL,
  label.column = NULL,
  ellipse = TRUE,
  ellipse.level = 0.95,
  plot.zero.line.x = TRUE,
  plot.zero.line.y = TRUE,
  point.size = 3
)

Arguments

DEprot.sPLSDA.object

An object of class DEprot.sPLSDA.

comp.x

Number indicating which component to display on the x-axis. Default: 1.

comp.y

Number indicating which component to display on the y-axis. Default: 2.

color.column

String indicating the name of the column in the metadata to use as factor for the dot colors. Default: NULL (the column used to fit the model).

shape.column

String indicating the name of the column in the metadata to use as factor for the dot shapes. Default: NULL (all dots).

label.column

String indicating the name of the column in the metadata to use as label of the dots. Default: NULL (no labeling).

ellipse

Logical value indicating whether a confidence ellipse should be drawn around each group of the color.column. Default: TRUE.

ellipse.level

Numeric value (0-1) indicating the confidence level of the ellipses. Default: 0.95.

plot.zero.line.x

Logical value to indicate whether to plot a gray dashed line in correspondence of x=0. Default: TRUE.

plot.zero.line.y

Logical value to indicate whether to plot a gray dashed line in correspondence of y=0. Default: TRUE.

point.size

Numeric value indicating the size of the dots. Default: 3.

Value

A ggplot object.

Details

The ellipses are a reading aid, not a test: a supervised model is fitted to separate the classes, so on the training samples the groups will look tidy even when the cross-validated error rate is poor. The error rates stored in the performance slot are what says whether the separation holds (plot.sPLSDA.performance).

Author

Sebastian Gregoricchio

Examples

splsda <- perform.sPLSDA(DEprot.object = DEprot::test.toolbox$dpo.imp,
                         group.column = "condition",
                         keepX = 5,
                         validate = FALSE)
#> Warning: The number of 'folds' (5) is larger than the smallest class (4 samples): 'folds' has been set to 4.

plot.sPLSDA.scatter(DEprot.sPLSDA.object = splsda,
                    comp.x = 1,
                    comp.y = 2,
                    shape.column = "replicate")
#> Warning: The following aesthetics were dropped during statistical transformation: shape.
#>  This can happen when ggplot fails to infer the correct grouping structure in
#>   the data.
#>  Did you forget to specify a `group` aesthetic or to convert a numerical
#>   variable into a factor?