Plot concordance of -log10 p-values between two methods
Source:R/plot_pvalue_concordance.R
plot_pvalue_concordance.Rd
Creates a scatter or hexbin plot comparing -log10 transformed p-values from two statistical methods. Optionally colors points by significance and facets by a grouping variable. Correlation coefficients and regression lines are shown globally or per facet.
Usage
plot_pvalue_concordance(
data,
x_var,
y_var,
x_sig_source = NULL,
y_sig_source = NULL,
facet_col = NULL,
facet_levels = NULL,
title = NULL,
x_label = NULL,
y_label = NULL,
color_label = NULL,
sig_thr = 0.05,
log_cap = 5,
epsilon = 1e-16,
point_size = 0.5,
hex = FALSE
)
Arguments
- data
Data frame containing p-values and optional grouping or significance columns.
- x_var
Character. Name of the column for x-axis p-values.
- y_var
Character. Name of the column for y-axis p-values.
- x_sig_source
Optional character. Column for significance of x p-values.
- y_sig_source
Optional character. Column for significance of y p-values.
- facet_col
Optional character. Column name to facet the plot by.
- facet_levels
Optional character vector. Subset of levels to include from
facet_col
.- title
Character. Optional plot title.
- x_label
Character. X-axis label. Defaults to
-log10(x_var)
.- y_label
Character. Y-axis label. Defaults to
-log10(y_var)
.- sig_thr
Numeric. P-value threshold for calling significance. Default is 0.05.
- log_cap
Numeric. Maximum value shown for -log10(p). Default is 5.
- epsilon
Numeric. Small constant added before log10 transform. Default is 1e-16.
- point_size
Numeric. Size of points in the scatter plot. Default is 0.5.
- hex
Logical. If TRUE, use hexagonal binning instead of individual points. Default is FALSE.
Details
If hex = TRUE
, a hexbin plot is produced without individual points or significance coloring.
Otherwise, a scatter plot is shown with optional significance-based coloring and shape encoding for capped values.
Correlation (Pearson's r) and regression lines are shown globally or per facet if faceting is enabled.