plot_factors_vs_cov: Scatterplots of a factor's values againt the sample...

View source: R/mefisto.R

plot_factors_vs_covR Documentation

Scatterplots of a factor's values againt the sample covariates

Description

Scatterplots of a factor's values againt the sample covariates

Usage

plot_factors_vs_cov(
  object,
  factors = "all",
  covariates = NULL,
  warped = TRUE,
  show_missing = TRUE,
  scale = FALSE,
  color_by = NULL,
  shape_by = NULL,
  color_name = NULL,
  shape_name = NULL,
  dot_size = 1.5,
  alpha = 1,
  stroke = NULL,
  legend = TRUE,
  rotate_x = FALSE,
  rotate_y = FALSE,
  return_data = FALSE,
  show_variance = FALSE
)

Arguments

object

a trained MOFA object using MEFISTO.

factors

character or numeric specifying the factor(s) to plot, default is "all"

covariates

specifies sample covariate(s) to plot against: (1) a character giving the name of a column present in the sample covariates or sample metadata. (2) a character giving the name of a feature present in the training data. (3) a vector of the same length as the number of samples specifying continuous numeric values per sample. Default is the first sample covariates in covariates slot

warped

logical indicating whether to show the aligned covariate (default: TRUE), only relevant if warping has been used to align multiple sample groups

show_missing

(for 1-dim covariates) logical indicating whether to include samples for which shape_by or color_by is missing

scale

logical indicating whether to scale factor values.

color_by

(for 1-dim covariates) specifies groups or values used to color the samples. This can be either: (1) a character giving the name of a feature present in the training data. (2) a character giving the same of a column present in the sample metadata. (3) a vector of the same length as the number of samples specifying discrete groups or continuous numeric values.

shape_by

(for 1-dim covariates) specifies groups or values used to shape the samples. This can be either: (1) a character giving the name of a feature present in the training data, (2) a character giving the same of a column present in the sample metadata. (3) a vector of the same length as the number of samples specifying discrete groups.

color_name

(for 1-dim covariates) name for color legend.

shape_name

(for 1-dim covariates) name for shape legend.

dot_size

(for 1-dim covariates) numeric indicating dot size.

alpha

(for 1-dim covariates) numeric indicating dot transparency.

stroke

(for 1-dim covariates) numeric indicating the stroke size

legend

(for 1-dim covariates) logical indicating whether to add legend.

rotate_x

(for spatial, 2-dim covariates) Rotate covariate on x-axis

rotate_y

(for spatial, 2-dim covariates) Rotate covariate on y-axis

return_data

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

show_variance

(for 1-dim covariates) logical indicating whether to show the marginal variance of inferred factor values (only relevant for 1-dimensional covariates)

Details

To investigate the factors pattern along the covariates (such as time or a spatial coordinate) this function an be used to plot a scatterplot of the factor againt the values of each covariate

Value

Returns a ggplot2 object

Examples

# Using an existing trained model
file <- system.file("extdata", "MEFISTO_model.hdf5", package = "MOFA2")
model <- load_model(file)
plot_factors_vs_cov(model)

bioFAM/MOFA2 documentation built on June 12, 2024, 3:57 p.m.