samples.Rd
This function allows the user to format the aesthetics for the samples.
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)
an object of class biplot
.
a vector containing the groups or classes for which the samples should be displayed, with default bp$g
.
the colour(s) for the samples, with default blue
.
the plotting character(s) for the samples, with default 16
.
the character expansion(s) for the samples, with default 1
.
a logical value indicating whether the samples should be labelled, with default FALSE
. Alternatively, specify "ggrepel"
for non-overlapping placement of labels.
a vector of the same length as which
with label names for the samples, with default NULL
. If NULL
, the rownames(bp)
are used. Alternatively, a custom vector of length n
should be used.
a vector of the same length as which
with label colours for the samples, with default as the same colour of the sample points.
a vector of the same length as which
with label text expansions for the samples, with default 0.75
.
the side at which the label of the plotted point appears, with default bottom
. Note that unlike the argument pos
in text()
, options are "bottom
", "left
", "top
", "right
" and not 1
, 2
, 3
, 4
.
the offset of the label from the plotted point. See ?text
for a detailed explanation of the argument offset
.
a logical value indicating whether samples are connected in order of rows of the data matrix, with default FALSE
.
the colour of the connecting line, with default black
.
the line type of the connecting line, with default 1
.
the line width of the connecting line, with default 1
.
the opacity level of the plotted points, with default 1
for an opaque point.
The object of class biplot
will be appended with a list called samples
containing the following elements:
a vector containing the groups or classes for which the samples (and means) are displayed.
the colour(s) of the samples.
the plotting character(s) of the samples.
the character expansion(s) of the plotting character(s) of the samples.
a logical value indicating whether samples are labelled.
the label names of the samples.
the label colours of the samples.
the label text expansions of the samples.
the side at which the label of the plotted point appears..
the offset of the label from the plotted point.
a logical value indicating whether samples are connected in order of the rows of the data matrix.
the colour of the connecting line.
the line type of the connecting line.
the line width of the connecting line.
the opacity level of the plotted points.
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.
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()
#> Warning: Use of `df$x` is discouraged.
#> ℹ Use `x` instead.
#> Warning: Use of `df$y` is discouraged.
#> ℹ Use `y` instead.
#> Warning: Use of `df$z` is discouraged.
#> ℹ Use `z` instead.
#> Warning: Use of `df$x` is discouraged.
#> ℹ Use `x` instead.
#> Warning: Use of `df$y` is discouraged.
#> ℹ Use `y` instead.
#> Warning: Use of `df$z` is discouraged.
#> ℹ Use `z` instead.
#> Warning: Use of `df$x` is discouraged.
#> ℹ Use `x` instead.
#> Warning: Use of `df$y` is discouraged.
#> ℹ Use `y` instead.
#> Warning: Use of `df$z` is discouraged.
#> ℹ Use `z` instead.
#> Warning: Use of `df$x` is discouraged.
#> ℹ Use `x` instead.
#> Warning: Use of `df$y` is discouraged.
#> ℹ Use `y` instead.
#> Warning: Use of `df$z` is discouraged.
#> ℹ Use `z` instead.
#> Warning: Use of `df$x` is discouraged.
#> ℹ Use `x` instead.
#> Warning: Use of `df$y` is discouraged.
#> ℹ Use `y` instead.
#> Warning: Use of `df$z` is discouraged.
#> ℹ Use `z` instead.
#> Warning: Use of `df$x` is discouraged.
#> ℹ Use `x` instead.
#> Warning: Use of `df$y` is discouraged.
#> ℹ Use `y` instead.
#> Warning: Use of `df$z` is discouraged.
#> ℹ Use `z` instead.
#> Warning: ggrepel: 14 unlabeled data points (too many overlaps). Consider increasing max.overlaps
#> Warning: ggrepel: 14 unlabeled data points (too many overlaps). Consider increasing max.overlaps