View source: R/parafac_plot_functions.R
eempf_residuals_plot | R Documentation |
A raster of plots is created. Each column shows one sample. The top n rows show the n components from the model according their occurance in the certain samples. The second last row shows the residual, not covered by any component in the model and the last row shows the whole sample.
eempf_residuals_plot(
pfmodel,
eem_list,
res_data = NULL,
spp = 5,
select = NULL,
residuals_only = FALSE,
cores = parallel::detectCores(logical = FALSE),
contour = FALSE,
colpal = "default"
)
pfmodel |
object of class parafac containing the generated model |
eem_list |
object of class eemlist with all the samples that should be plotted |
res_data |
optional, data of sample residuals related to the model, output from |
spp |
optional, samples per plot |
select |
optional, character vector of samples you want to plot |
residuals_only |
plot only residuals |
cores |
number of cores to use for parallel processing |
contour |
logical, states whether contours should be plotted |
colpal |
"default" to use the viridis colour palette, "rainbow" to use a subset of the rainbow palette, any custom vector of colors or a colour palette. A gradient will be produced from this vector. Larger vectors (e.g. 50 elements) can produce smoother gradients. |
eem_list may contain samples not used for modelling. Calculation is done by A_missing
. This especially interesting if outliers are excluded prior modelling and should be evaluated again afterwards.
Usually, residuals contain negative values, while these is the exception in samples and PARAFAC components. Therefore, we decided to use a similar colour palette as in the other plot functions but adding a purple tone for negative values.
several ggplot objects
data(eem_list)
data(pf_models)
eem_list <- eem_extract(eem_list, 1:10)
eem_list <- eem_rem_scat(eem_list, rep(TRUE, 4), c(15,10,16,12))
eempf_residuals_plot(pf4[[1]], eem_list, cores = 2)
# use other colour schemes:
# eempf_residuals_plot(pf4[[1]], eem_list, colpal = c("blue",heat.colors(50)))
# plots <- eempf_residuals_plot(pf4[[1]], eem_list)
# lapply(plots, function(pl){
# pl +
# scale_fill_viridis_c() +
# scale_colour_viridis_c()
# })
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.