A GPU-accelerated volcano plot for differential-expression results. Points are rendered with WebGL (via regl-scatterplot) so hundreds of thousands to millions of genes/features stay interactive, while axes, threshold guides and gene labels are drawn as crisp vector overlays.
Usage
volcano(
data,
fc_threshold = 1,
p_threshold = 0.05,
point_size = 3,
opacity = 0.8,
colors = NULL,
x_label = "log2 fold change",
y_label = "-log10 p-value",
show_threshold_lines = TRUE,
label_top_n = 10,
bounded_view = TRUE,
theme = NULL,
width = NULL,
height = NULL,
element_id = NULL
)Arguments
- data
A data frame with numeric columns
x(log2 fold change) andy(-log10p-value). An optionallabelcolumn supplies gene names for tooltips and top-hit labels. AyofInf(p = 0) is drawn just above the highest finite value and the p-value threshold, and counts as significant. Rows withNAorNaNinxory, or ayof-Inf, are not drawn, with a warning that counts them; Python gives the same warning.- fc_threshold
Absolute log2 fold-change cutoff for calling a hit.
- p_threshold
P-value cutoff (applied on the
-log10scale).- point_size
Point radius in pixels.
- opacity
Point opacity in
[0, 1].- colors
Optional named list of hex colors for the three point classes:
up,downandns(not significant).NULL(the default) uses the component's built-in palette.- x_label, y_label
Axis titles.
- show_threshold_lines
Draw the fold-change / p-value threshold guides. The y axis then always reaches the p-value guide.
- label_top_n
Number of top up- and down-regulated genes to label.
Inflabels every up- and down-regulated gene, as inlollipop();0labels none.- bounded_view
Keep pan and zoom inside the data: zooming out stops at the view that shows all of it, a pan stops at its edges, and zooming in stops at 1/10,000 of its range.
FALSElets the view move freely. Either way a double-click, or the reset button in the top right corner of the plot, goes back to the view of all the data.- theme
Optional named list of theme overrides (colors, fonts, ...) merged over the component defaults in the browser.
NULLuses the default theme. Itspaddingentry is the space in px between the edge of the widget and the plot: one number for every side, or numbers namedtop,right,bottomandleftin a list or vector, a side left out keeping the default of 10. A colour given as a CSS custom property, such asbackground = "var(--bg)", takes the value the page gives it when the plot draws. After the page changes the property, what the plot drew on a canvas keeps the old colour until it draws again: resize the widget or render it again.- width, height
Widget dimensions (any valid CSS size).
- element_id
Optional explicit DOM id.