When to Use
- Differential gene expression: Standard plot for RNA-seq/microarray DEG analysis
- Proteomics: Display differential protein abundance
- Metabolomics: Show metabolite changes between conditions
- CRISPR screens: Visualize gene-level enrichment/depletion
- Any differential analysis: When fold change and significance both matter
- Quality control: Identify outliers and assess overall signal strength
Basic Example
Key Methods
Data Input
with_point(name, log2fc, pvalue)
Add a single point. Useful for incremental building.
with_points(iter)
Add multiple points from an iterator of (name, log2fc, pvalue) tuples. Primary input method.
Into<String> / Into<f64>.
Thresholds
with_fc_cutoff(cutoff: f64)
Set absolute log₂FC threshold for up/down classification (default 1.0 — 2× fold change).
fc_cutoff.
with_p_cutoff(cutoff: f64)
Set p-value significance threshold (default 0.05).
−log10(p_cutoff).
Colors
with_color_up(color: impl Into<String>)
Set color for up-regulated points: log2fc ≥ fc_cutoff and pvalue ≤ p_cutoff (default "firebrick").
with_color_down(color: impl Into<String>)
Set color for down-regulated points: log2fc ≤ −fc_cutoff and pvalue ≤ p_cutoff (default "steelblue").
with_color_ns(color: impl Into<String>)
Set color for not-significant points (default "#aaaaaa").
Gene Labels
with_label_top(n: usize)
Label the n most significant points (lowest p-values). Default 0 — no labels.
with_label_style(style: LabelStyle)
Set label placement style (default LabelStyle::Nudge).
LabelStyle::Nudge(default) — Labels sorted by x and nudged vertically to reduce overlapLabelStyle::Exact— Labels at exact point position; may overlapLabelStyle::Arrow { offset_x, offset_y }— Labels offset by px with gray leader line
Other Options
with_point_size(size: f64)
Set circle radius in pixels (default 3.0).
with_pvalue_floor(floor: f64)
Set explicit p-value floor for −log10 transform. Points with pvalue == 0.0 are clamped to this value.
with_legend(label: impl Into<String>)
Enable legend showing Up, Down, and NS entries.
Examples
Standard Differential Expression
Custom Thresholds
Custom Colors
Arrow-style Labels
Zero p-values
p-values of exactly0.0 cannot be log-transformed. They are automatically capped at the smallest non-zero p-value in the data (or at pvalue_floor if set). This prevents infinite y positions.
Threshold Lines
Dashed threshold lines are drawn automatically:- Vertical lines at ±
fc_cutoff - Horizontal line at
−log10(p_cutoff)
See Also
- ManhattanPlot — For GWAS p-values across the genome
- Scatter — For general scatter plots without differential expression logic