qplot_kAmp.Rd
Plot amplitudes (a.k.a scores) of spectroscopic components
grouped by categorical variable by
. Amplitudes are provided as
hyperSpec
object.
qplot_kAmp(
scores,
Title = "Component amplitudes",
subTitle = NULL,
xLabel = labels(scores, ".wavelength"),
yLabel = labels(scores, "spc"),
by = "gr",
palette = hyGet_palette(scores),
add.violin = TRUE,
add.jitter = FALSE,
add.boxplot = TRUE,
violin.alpha = 0.25,
jitter.alpha = 0.3,
jitter.size = 1
)
qplot_scores(..., by = NULL, add.violin = FALSE)
An object of class hyperSpec
with factor scores, principal component scores, component amplitudes, etc.
The main title for the plot.
The second line of title, which will be smaller and and in italics.
A label for abscisa (x) axis.
A label for ordinate (y) axis.
A name of grouping variable. If NULL
, all data is ploted.
Default is by = "gr"
for qplot_kAmp
and
by = NULL
for qplot_scores
.
A color palette to be used in plotting. (...)
Logical. If TRUE
adds so called violin (i.e.,
symmetrical probarility density) plot.
Default is TRUE
for qplot_kAmp
.
Logical. If TRUE
adds jitter plot.
Default is FALSE
.
Logical. If TRUE
adds boxplot.
Default is TRUE
.
Transperency of violin plot.
Transperency of jitter plot.
Point size in jitter plot.
(The same parameters as above).
A ggplot
object.
More details in package ggplot2.
Plots are drawn in this order: violin plot, jitter plot, boxplot.
If more information on matrix decomposition/factorisation is needed it can be found here or here).
Other spHelper plots:
check_palette()
,
layer_spRangeMean()
,
plot_colors()
,
plot_hyPalette()
,
plot_spCompare()
,
plot_spDiff()
,
plot_spDistribution()
,
qplot_confusion()
,
qplot_crosstab()
,
qplot_infoDim()
,
qplot_kSp()
,
qplot_prediction()
,
qplot_spRangeCenter()
,
qplot_spRangeMedian()
,
qplot_spStat()
,
qplot_spc()
,
rmExpr()
,
rm_stripes()
,
stat_chull()
Other component analysis / factorisation related functions in spHelper:
getScores()
,
infoDim()
,
plot_spDiff()
,
qplot_infoDim()
,
qplot_kSp()
,
qplot_spc()
,
reconstructSp()
,
sortLoadings()
,
unipeak()
,
whichOutlier()
data(Scores2)
qplot_kAmp(Scores2)
#> Warning: Function 'hyperSpec::chk.hy' is deprecated.
#> Use function 'assert_hyperSpec' instead.
#> Error in dplyr::mutate(., row = row_number()): ℹ In argument: `row = row_number()`.
#> Caused by error in `row_number()`:
#> ! could not find function "row_number"
qplot_scores(Scores2)
#> Warning: Function 'hyperSpec::chk.hy' is deprecated.
#> Use function 'assert_hyperSpec' instead.
#> Error in dplyr::mutate(., row = row_number()): ℹ In argument: `row = row_number()`.
#> Caused by error in `row_number()`:
#> ! could not find function "row_number"
data(Scores3)
qplot_kAmp(Scores3, by = "class")
#> Warning: Function 'hyperSpec::chk.hy' is deprecated.
#> Use function 'assert_hyperSpec' instead.
#> Error in dplyr::mutate(., row = row_number()): ℹ In argument: `row = row_number()`.
#> Caused by error in `row_number()`:
#> ! could not find function "row_number"
sp3 <- hyAdd_color(Scores3, "class")
qplot_kAmp(sp3, by = "class")
#> Warning: Function 'hyperSpec::chk.hy' is deprecated.
#> Use function 'assert_hyperSpec' instead.
#> Error in dplyr::mutate(., row = row_number()): ℹ In argument: `row = row_number()`.
#> Caused by error in `row_number()`:
#> ! could not find function "row_number"
p <- qplot_scores(Scores2, add.jitter = TRUE)
#> Warning: Function 'hyperSpec::chk.hy' is deprecated.
#> Use function 'assert_hyperSpec' instead.
#> Error in dplyr::mutate(., row = row_number()): ℹ In argument: `row = row_number()`.
#> Caused by error in `row_number()`:
#> ! could not find function "row_number"
p
#> function (x, wrap = panderOptions("p.wrap"), sep = panderOptions("p.sep"),
#> copula = panderOptions("p.copula"), limit = Inf, keep.trailing.zeros = panderOptions("keep.trailing.zeros"),
#> missing = panderOptions("missing"), digits = panderOptions("digits"),
#> round = panderOptions("round"))
#> {
#> attributes(x) <- NULL
#> stopifnot(is.vector(x))
#> stopifnot(all(sapply(list(wrap, sep, copula), function(x) is.character(x) &&
#> length(x) == 1)))
#> x.len <- length(x)
#> if (x.len == 0) {
#> return("")
#> }
#> stopifnot(x.len <= limit)
#> w <- which(is.na(x))
#> if (is.numeric(x)) {
#> x <- round(x, digits = round)
#> if (!keep.trailing.zeros) {
#> x <- sapply(x, format, trim = TRUE, digits = digits,
#> decimal.mark = panderOptions("decimal.mark"))
#> }
#> else {
#> x <- format(x, trim = TRUE, digits = digits, decimal.mark = panderOptions("decimal.mark"))
#> }
#> }
#> if (length(w) > 0) {
#> x[w] <- missing
#> }
#> if (x.len == 1) {
#> wrap(x, wrap)
#> }
#> else if (x.len == 2) {
#> paste(wrap(x, wrap), collapse = copula)
#> }
#> else {
#> paste0(paste(wrap(head(x, -1), wrap), collapse = sep),
#> copula, wrap(tail(x, 1), wrap))
#> }
#> }
#> <bytecode: 0x0000022b08b62740>
#> <environment: namespace:pander>
p + theme_bw()
#> NULL