plot_variance_explained_by_covariates {MOFA2} | R Documentation |
This function plots the variance explained by the smooth components (Gaussian processes) underlying the factors in MEFISTO across different views and groups, as specified by the user.
plot_variance_explained_by_covariates( object, factors = "all", x = "view", y = "factor", split_by = NA, min_r2 = 0, max_r2 = NULL, compare_total = FALSE, legend = TRUE )
object |
a |
factors |
character vector with a factor name(s), or numeric vector with the index(es) of the factor(s). Default is "all". |
x |
character specifying the dimension for the x-axis ("view", "factor", or "group"). |
y |
character specifying the dimension for the y-axis ("view", "factor", or "group"). |
split_by |
character specifying the dimension to be faceted ("view", "factor", or "group"). |
min_r2 |
minimum variance explained for the color scheme (default is 0). |
max_r2 |
maximum variance explained for the color scheme. |
compare_total |
plot corresponding variance explained in total in addition |
legend |
logical indicating whether to add a legend to the plot (default is TRUE). |
Note that this function requires the use of MEFISTO.
To activate the functional MEFISTO framework, specify mefisto_options when preparing the training using prepare_mofa
A list of ggplot
objects (if compare_total
is TRUE) or a single ggplot
object.
Consider using cowplot::plot_grid(plotlist = ...) to combine the multiple plots that this function generates.
# load_model file <- system.file("extdata", "MEFISTO_model.hdf5", package = "MOFA2") model <- load_model(file) plot_variance_explained_by_covariates(model) # compare to toal variance explained plist <- plot_variance_explained_by_covariates(model, compare_total = TRUE) cowplot::plot_grid(plotlist = plist)