Skip to contents

Creates a volcano plot with capped -log10(p-values) on the y-axis. Supports effect size threshold lines, feature annotations, and flexible color and shape aesthetics.

Usage

plot_volcano(
  data,
  x_var,
  y_var,
  color_var = NULL,
  shape_var = NULL,
  features = NULL,
  sig_thr = NULL,
  effect_thr = NULL,
  title = NULL,
  x_label = NULL,
  y_label = NULL,
  color_label = NULL,
  shape_label = NULL,
  log_cap = 5,
  epsilon = 1e-15,
  point_size = 1
)

Arguments

data

Data frame with variables to plot.

x_var

String. Column name for x-axis (e.g., effect size).

y_var

String. Column name for y-axis (p-values to transform).

color_var

String. Column name mapped to point colors.

shape_var

String. Column name mapped to point shapes.

features

Optional vector. Feature names to annotate.

sig_thr

Numeric. Significance threshold for horizontal line.

effect_thr

Numeric. Effect size threshold for vertical lines.

title

String. Plot title.

x_label

String. Custom x-axis label.

y_label

String. Custom y-axis label.

color_label

String. Legend title for color.

shape_label

String. Legend title for shape.

log_cap

Numeric. Max -log10(p) to cap values. Default is 5.

epsilon

Numeric. Small constant to avoid log10(0). Default 1e-15.

point_size

Numeric. Size of points. Default is 1.

Value

A ggplot2 object.