plot_variance_explained_per_feature: Plot variance explained by the model for a set of features...

Description Usage Arguments Value Examples

View source: R/calculate_variance_explained.R

Description

Plot variance explained by the model for a set of features

Returns a tile plot with a group on the X axis and a feature along the Y axis

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
plot_variance_explained_per_feature(
  object,
  view,
  features = 10,
  split_by_factor = FALSE,
  group_features_by = NULL,
  groups = "all",
  factors = "all",
  min_r2 = 0,
  max_r2 = NULL,
  legend = TRUE,
  return_data = FALSE,
  ...
)

Arguments

object

a MOFA object.

view

a view name or index.

features

a vector with indices or names for features from the respective view, or number of top features to be fetched by their loadings across specified factors. "all" to plot all features.

split_by_factor

logical indicating whether to split R2 per factor or plot R2 jointly

group_features_by

column name of features metadata to group features by

groups

a vector with indices or names for sample groups (default is all)

factors

a vector with indices or names for factors (default is all)

min_r2

minimum variance explained for the color scheme (default is 0).

max_r2

maximum variance explained for the color scheme.

legend

logical indicating whether to add a legend to the plot (default is TRUE).

return_data

logical indicating whether to return the data frame to plot instead of plotting

...

extra arguments to be passed to calculate_variance_explained

Value

ggplot object

Examples

1
2
3
4
# Using an existing trained model
file <- system.file("extdata", "model.hdf5", package = "MOFA2")
model <- load_model(file)
plot_variance_explained_per_feature(model, view = 1)

MOFA2 documentation built on Nov. 8, 2020, 7:28 p.m.