plot_weights_scatter: Scatterplots of weights

plot_weights_scatterR Documentation

Scatterplots of weights

Description

Scatterplot of the weights values for two factors

Usage

plot_weights_scatter(
  object,
  factors,
  view = 1,
  color_by = NULL,
  shape_by = NULL,
  dot_size = 1,
  name_color = "",
  name_shape = "",
  show_missing = TRUE,
  abs = FALSE,
  scale = TRUE,
  legend = TRUE
)

Arguments

object

a trained MOFA object.

factors

a vector of length two with the factors to plot. Factors can be specified either as a characters using the factor names, or as numeric with the index of the factors

view

character vector with the voiew name, or numeric vector with the index of the view to use. Default is the first view.

color_by

specifies groups or values used to color the features. This can be either

  • a character giving the same of a column in the feature metadata slot

  • a vector specifying the value for each feature.

  • a dataframe with two columns: "feature" and "color"

shape_by

specifies groups or values used to shape the features. This can be either

  • a character giving the same of a column in the feature metadata slot

  • a vector specifying the value for each feature.

  • a dataframe with two columns: "feature" and "shape"

dot_size

numeric indicating dot size.

name_color

name for color legend (usually only used if color_by is not a character itself)

name_shape

name for shape legend (usually only used if shape_by is not a character itself)

show_missing

logical indicating whether to include dots for which shape_by or color_by is missing

abs

logical indicating whether to take the absolute value of the weights.

scale

logical indicating whether to scale all weights from -1 to 1 (or from 0 to 1 if abs=TRUE).

legend

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

Details

One of the first steps for the annotation of factors is to visualise and group/color them using known covariates such as phenotypic or clinical data. This method generates a single scatterplot for the combination of two latent factors.

Value

Returns a ggplot2 object

Examples

# Using an existing trained model on simulated data
file <- system.file("extdata", "model.hdf5", package = "MOFA2")
model <- load_model(file)
plot_weights_scatter(model, factors = 1:2)

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