-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathplotScree.Rd
More file actions
101 lines (82 loc) · 3.51 KB
/
plotScree.Rd
File metadata and controls
101 lines (82 loc) · 3.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/AllGenerics.R, R/plotScree.R
\name{plotScree}
\alias{plotScree}
\alias{plotScree,SingleCellExperiment-method}
\alias{plotScree,ANY-method}
\title{Create a scree plot}
\usage{
plotScree(x, ...)
\S4method{plotScree}{SingleCellExperiment}(x, dimred, ...)
\S4method{plotScree}{ANY}(x, ...)
}
\arguments{
\item{x}{a
\code{\link[TreeSummarizedExperiment:TreeSummarizedExperiment-constructor]{TreeSummarizedExperiment}}
\code{\link[vegan:eigenvals]{eigenvals}} or a vector.}
\item{...}{additional parameters for plotting
\itemize{
\item \code{show.barplot}: \code{Logical scalar}. Whether to show a
barplot. (Default: \code{TRUE})
\item \code{show.points}: \code{Logical scalar}. Whether to show a
points. (Default: \code{TRUE})
\item \code{show.line}: \code{Logical scalar}. Whether to show a
line. (Default: \code{TRUE})
\item \code{show.labels}: \code{Logical scalar}. Whether to show a
labels for each point. (Default: \code{FALSE})
\item \code{add.proportion}: \code{Logical scalar}. Whether to show
proportion of explained variance, i.e., raw eigenvalues.
(Default: \code{TRUE})
\item \code{add.cumulative}: \code{Logical scalar}. Whether to show
cumulative explained variance calculated from eigenvalues.
(Default: \code{FALSE})
\item \code{n}: \code{Integer scalar}. Number of eigenvalues to plot.
If \code{NULL}, all eigenvalues are plotted. (Default: \code{NULL})
\item \code{show.names}: \code{Logical scalar}. Whether to show names of
components in x-axis. If \code{FALSE}, the index of component is shown
instead of names. (Default: \code{FALSE})
\item \code{eig.name}: \code{Character scalar}. The name of the attribute
in \code{reducedDim(x, dimred)} that contains the eigenvalues.
(Default: \code{c("eig", "varExplained")})
}}
\item{dimred}{\code{Character scalar} or \code{integer scalar}. Determines
the reduced dimension to plot. This is used when \code{x} is a
\code{TreeSummarizedExperiment} to extract the eigenvalues from
\code{reducedDim(x, dimred)}.}
}
\value{
A \code{ggplot2} object
}
\description{
\code{plotScree} generates a scree plot to visualize the eigenvalues.
The eigenvalues can be provided either as a part of a
\code{TreeSummarizedExperiment} object or as a separate \code{vector}.
This plot illustrates the decline in eigenvalues across components,
helping to assess the importance of each component.
}
\details{
\code{plotScree} generates a scree plot to visualize the relative importance
of components in dimensionality reduction techniques such as Principal
Component Analysis (PCA) or Principal Coordinate Analysis (PCoA). If the
input is a \code{TreeSummarizedExperiment} object, the function extracts
eigenvalues from the specified reduced dimension slot, which requires that
dimensionality reduction has been performed beforehand using a dedicated
function. Alternatively, if the input is a \code{vector} or an
\code{eigenvals} object, these values are directly used as eigenvalues for
the plot.
The plot can include a combination of barplot, points, connecting lines,
and labels, which can be controlled using the \code{show.*} parameters.
An option to show cumulative explained variance is also available by setting
\code{add.cumulative = TRUE}.
}
\examples{
library(miaViz)
library(scater)
data("enterotype", package = "mia")
tse <- enterotype
# Run PCA and store results into TreeSE
tse <- transformAssay(tse, method = "clr", pseudocount = TRUE)
tse <- runPCA(tse, assay.type = "clr")
# Plot scree plot
plotScree(tse, "PCA", add.cumulative = TRUE)
}