Learn R Programming

SUMO (version 1.2.3)

plot_weights: Visualize feature loadings (weights)

Description

Generate scatter or histogram plots of feature loadings (weights) from simulated or real multi-omics data. Supports per-omic views and, when available, an integrated view.

Usage

plot_weights(
  sim_object,
  omic = 1,
  factor_num = 1,
  type = "scatter",
  show.legend = TRUE
)

Value

A ggplot object (single plot) or a grob returned by grid.arrange when multiple panels are combined.

Arguments

sim_object

A multi-omics object (e.g., from simulate_twoOmicsData() and as_multiomics()).

omic

Integer or character. Which view to plot: 1 (omic.one), 2 (omic.two), or "integrated" (if present). Default 1.

factor_num

Integer or "all". Which factor(s) to visualize. Default 1.

type

Character. Plot type: "scatter" or "histogram". Default "scatter".

show.legend

Logical. Whether to show the legend. Default TRUE.

Examples

Run this code
output_obj <- simulate_twoOmicsData(
  vector_features = c(4000, 3000),
  n_samples = 100,
  n_factors = 2,
  signal.samples = NULL,
  signal.features.one = NULL,
  signal.features.two = NULL,
  snr = 2.5,
  num.factor = "multiple",
  advanced_dist = "mixed"
)

output_obj <- as_multiomics(output_obj)

plot_weights(
  sim_object = output_obj,
  factor_num = 1,
  omic = 1,
  type = "scatter",
  show.legend = FALSE
)

plot_weights(
  sim_object = output_obj,
  factor_num = 2,
  omic = 2,
  type = "histogram"
)

Run the code above in your browser using DataLab