Skip to contents

This function plots the mean-variance relationship across genes based on log2-counts-per-million (log2-CPM) values derived from raw count data. Each gene is plotted by its average log2-CPM (mean expression) and standard deviation across samples. A LOWESS curve is overlaid to show the global trend, similar to the diagnostic plot produced by limma::voom.

Usage

plot_mean_variance_trend(
  X,
  title = NULL,
  x_label = NULL,
  y_label = NULL,
  point_size = 1
)

Arguments

X

A numeric matrix or data.frame of **raw count data** (samples in rows, genes in columns).

title

An optional character string specifying the plot title.

x_label

An optional label for the x-axis. Defaults to "Mean log2-CPM".

y_label

An optional label for the y-axis. Defaults to "Standard deviation".

point_size

A numeric value for point size in the scatter plot (default = 1).

Value

A ggplot2 object showing the mean-standard deviation trend of log2-CPM values.