plot_man: Plot mediation exposure, mediator, and outcome per mediator

View source: R/plot_man.R

plot_manR Documentation

Plot mediation exposure, mediator, and outcome per mediator

Description

Plot mediation exposure, mediator, and outcome per mediator in M, as used in lotman & hitman, using ggplot2.

Usage

plot_man(
  E,
  M,
  Y,
  name = "top_mediators",
  main.v = "",
  xlab = "Log2 abundance",
  ylab = "Outcome",
  check.names = TRUE,
  manual.color = NULL
)

Arguments

E

A numeric vector of exposures.

M

A numeric matrix-like data object with one row per feature and one column per sample of mediators.

Y

A numeric vector of length(E) of outcomes. Only continuous, normally distributed outcomes currently supported.

name

Name of file to create. Set to NA to plot to screen instead of to file.

main.v

Character vector of main titles for plot.

xlab

Label for x-axis.

ylab

Label for y-axis.

check.names

Logical; should names(E)==colnames(M) & colnames(M)==names(Y) be checked?

manual.color

Vector passed to both scale_fill_manual and scale_color_manual.

Details

If manual.color is given, its length should be length(unique(E)).

Value

Invisibly, a ggplot2 object from the last row of M that was plotted.


jdreyf/ezlimmaplot documentation built on Feb. 8, 2025, 2:25 a.m.