samples {biplotEZ}R Documentation

Aesthetics for biplot samples

Description

This function allows formatting changes to samples.

Usage

samples (bp,  which = 1:bp$g, col = ez.col, pch = 16, cex = 1,
label = FALSE, label.name = NULL, label.col=NULL, label.cex = 0.75, 
label.side = "bottom", label.offset = 0.5,
connected=FALSE, connect.col = "black", connect.lty = 1, 
connect.lwd = 1, opacity = 1)

Arguments

bp

an object of class biplot.

which

vector of which groups of samples to display, with default bp$g.

col

sample colour, with default blue.

pch

sample plotting character, with default +.

cex

sample character expansion, with default 1.

label

logical (TRUE, FALSE), whether samples should be labelled, with default FALSE. Alternatively, specify "ggrepel" for non-overlapping placement of labels.

label.name

vector of length number of samples, with default NULL, rownames(bp) are used.

label.col

vector of length number of samples with the colour of the labels, defaulting to the colour of the sample points.

label.cex

label text expansion, with default 0.75.

label.side

side of the plotting character where label appears, with default bottom. Note that unlike the argument pos in text(), options are "bottom", "left", "top", "right" and not 1, 2, 3, 4.

label.offset

offset of the label from the data point. See ?text for a detailed explanation of the argument offset.

connected

logical, whether samples are connected in order of rows of data matrix, with default FALSE.

connect.col

colour of the connecting line, with default black.

connect.lty

line type of the connecting line, with default 1.

connect.lwd

line width of the connecting line, with default 1.

opacity

opacity of sample points, with default 1 (opaque).

Details

The arguments which, col, pch and cex are based on the specification of group.aes or classes. If no groups are specified, a single colour, plotting character and / or character expansion is expected. If g groups are specified, vectors of length g is expected, or values are recycled to length g.

The arguments label, label.cex, label.side and label.offset are based on the sample size n. A single value will be recycled n times or a vector of length n is expected.

Value

A list with the following components is available:

which

which means to display.

col

colour of the samples.

pch

plotting character of the samples.

cex

expansion of the plotting character of the samples.

label

TRUE or FALSE, whether samples should be labelled, with default FALSE.

label.name

If NULL, the row names will be used, with default NULL. Alternatively, a vector of length n should be used.

label.col

colour of the label.

label.cex

expansion of the label.

label.side

side at which to plot the label of samples.

label.offset

offset of the label from the data point.

connected

TRUE or FALSE, whether samples should be connected in row order of X.

connect.col

colour of the connecting line.

connect.lty

line type of the connecting line.

connect.lwd

line width of the connecting line.

opacity

opacity of sample points, with default 1 (opaque).

Examples

biplot(iris[,1:4]) |> PCA() |> samples(col="purple",pch=15, opacity=0.5) |> plot()
biplot(iris[,1:4]) |> PCA() |> 
  samples(col="purple",pch=NA, opacity=0.5, label = TRUE) |> plot()
biplot(iris[,1:4]) |> PCA() |> 
  samples(col="purple",pch=NA, opacity=0.5, label = TRUE, 
          label.name = paste("s:",1:150, sep="")) |> 
  plot()
biplot(iris[,1:4]) |> PCA() |> 
  samples(col="purple",pch=NA, opacity=0.5, label = "ggrepel") |> plot()


[Package biplotEZ version 2.0 Index]