← All tutorials

Volcano Plot Tutorial: Step-by-Step in R, Python, SPSS and StatFAS

Updated November 7, 2026 · StatFAS Tutorials · Beginner to intermediate

This tutorial shows how to create a volcano plot and run the statistics behind the volcano plot in four ways: SPSS, R, Python and the free Volcano Plot Maker on statfas.com. Every script is complete and can be copied into the software. For the concepts behind the volcano plot, read the guide Volcano Plot Explained: Meaning, Uses and Interpretation (R, Python, SPSS).

Step 1: Prepare the data

Genes in rows, samples in columns. Name sample columns by group plus a number (Control_1, Control_2, Treated_1, …). Values should be normalised and on the log2 scale (raw counts are log2(x + 1) transformed automatically on StatFAS when large). Alternatively, upload a results table with the columns Gene, log2FC and pvalue (and optionally padj).

Example layout:

Gene,Control_1,Control_2,Control_3,Treated_1,Treated_2,Treated_3
Gene0001,7.21,7.35,7.10,9.02,8.88,9.15
Gene0002,6.54,6.61,6.48,6.50,6.59,6.66

Step 2: SPSS

SPSS has no volcano plot procedure, but the ingredients are available: gene-wise t tests, a Benjamini–Hochberg correction computed with syntax, and a scatter plot built in the Chart Builder.

* Data: one row per sample, one column per gene (Gene0001 ... GeneN), plus GROUP (1 = Control, 2 = Treated).
T-TEST GROUPS=GROUP(1 2)
  /VARIABLES=Gene0001 TO Gene0100
  /CRITERIA=CI(.95).
* Copy the Welch p values and mean differences into a new dataset (File > Export or OMS),
* giving one row per gene with the variables log2FC and p.

* Benjamini-Hochberg FDR: sort p from largest to smallest, then run:
SORT CASES BY p (D).
COMPUTE m = 100.
COMPUTE rk = m - $CASENUM + 1.
COMPUTE q = MIN(1, p * m / rk).
IF ($CASENUM > 1 AND LAG(q) < q) q = LAG(q).
EXECUTE.

COMPUTE negLog10Q = -LG10(q).
COMPUTE sig = (q < .05 AND ABS(log2FC) >= 1).
EXECUTE.
GRAPH /SCATTERPLOT(BIVAR)=log2FC WITH negLog10Q BY sig.

Step 3: R

The code below runs Welch t tests per gene, adjusts the p values and draws the volcano plot with ggplot2. For raw RNA-seq counts, use DESeq2 or edgeR first.

library(ggplot2)
expr <- read.csv("expression.csv", row.names = 1)            # genes x samples, log2 scale
grp  <- factor(rep(c("Control", "Treated"), each = 6))

res <- as.data.frame(t(apply(expr, 1, function(x) {
  tt <- t.test(x[grp == "Treated"], x[grp == "Control"])    # Welch t test per gene
  c(log2FC = unname(tt$estimate[1] - tt$estimate[2]), p = tt$p.value)
})))
res$q <- p.adjust(res$p, method = "BH")                      # Benjamini-Hochberg FDR
res$status <- ifelse(res$q < 0.05 & abs(res$log2FC) >= 1,
                     ifelse(res$log2FC > 0, "Up", "Down"), "NS")

ggplot(res, aes(log2FC, -log10(q), colour = status)) +
  geom_point(size = 1.3) +
  scale_colour_manual(values = c(Up = "#d62728", Down = "#1f77b4", NS = "grey60")) +
  geom_vline(xintercept = c(-1, 1), linetype = "dashed") +
  geom_hline(yintercept = -log10(0.05), linetype = "dashed") +
  labs(x = "log2 fold change (Treated vs Control)", y = "-log10(FDR)") +
  theme_classic()
ggsave("volcano.png", width = 6, height = 5, dpi = 300)

# RNA-seq raw counts: use DESeq2, then plot with EnhancedVolcano
# library(DESeq2); library(EnhancedVolcano)
# dds <- DESeq(DESeqDataSetFromMatrix(counts, coldata, design = ~ condition))
# r <- results(dds); EnhancedVolcano(r, lab = rownames(r), x = "log2FoldChange", y = "padj")

Step 4: Python

The code below uses SciPy for gene-wise Welch t tests, statsmodels for Benjamini–Hochberg correction and Matplotlib for the volcano plot.

import numpy as np, pandas as pd
import matplotlib.pyplot as plt
from scipy import stats
from statsmodels.stats.multitest import multipletests

df = pd.read_csv("expression.csv", index_col=0)           # genes x samples, log2 scale
ctrl, trt = df.filter(like="Control"), df.filter(like="Treated")
t, p = stats.ttest_ind(trt, ctrl, axis=1, equal_var=False)  # Welch t test per gene
res = pd.DataFrame({"log2FC": trt.mean(axis=1) - ctrl.mean(axis=1), "p": p}, index=df.index)
res["q"] = multipletests(res["p"], method="fdr_bh")[1]      # Benjamini-Hochberg FDR
res["sig"] = (res["q"] < 0.05) & (res["log2FC"].abs() >= 1)

plt.figure(figsize=(6, 5))
plt.scatter(res["log2FC"], -np.log10(res["q"]), s=8, c=np.where(res["sig"], "#d62728", "#9a9a9a"))
for x in (-1, 1): plt.axvline(x, ls="--", c="k", lw=0.8)
plt.axhline(-np.log10(0.05), ls="--", c="k", lw=0.8)
plt.xlabel("log2 fold change (Treated vs Control)"); plt.ylabel("-log10(FDR)")
plt.tight_layout(); plt.savefig("volcano.png", dpi=300)
print(res.sort_values("p").head(10))

Step 5: The easy way on statfas.com

The Volcano Plot Maker needs no installation and no code. Follow these steps:

  1. Open the tool. Go to the StatFAS Volcano Plot Maker.
  2. Add data. Click Load example data to see the layout, then paste or upload an expression matrix (genes by samples) or a results table with log2FC and p values.
  3. Set thresholds. Choose the |log2FC| threshold, the FDR or p cutoff, the number of labelled genes and the colours.
  4. Read the results. The tool runs Welch t tests with Benjamini–Hochberg FDR and draws the volcano plot, then writes the APA 7 results text and a top-genes table.
  5. Download. Download the PNG or SVG figure, or a Word file with the figure, the tables and the interpretation.
Try the Volcano Plot Maker free
Upload or paste data and get the volcano plot, the statistics and an APA 7 write-up in seconds.
Open the free Volcano Plot Maker

Step 6: Interpret and report in APA 7

Check these points before the volcano plot goes into a manuscript:

Example APA 7 results paragraph:

Differential expression between the treated group (n = 6) and the control group (n = 6) was tested for 1,500 genes using Welch’s t tests with Benjamini–Hochberg correction. Using FDR < .05 and |log2 fold change| ≥ 1, 61 genes were up-regulated and 65 were down-regulated in the treated group (Figure 1).

Avoid these mistakes with the volcano plot:

Frequently asked questions

What do the axes of a volcano plot mean?

The x axis is the log2 fold change between two groups, and the y axis is the negative log10 of the p value or FDR. Points far from zero horizontally show large changes; points high up show strong statistical evidence.

Which cut-offs should a volcano plot use?

Common choices are |log2 fold change| ≥ 1 and FDR < .05. Choose thresholds before looking at the data and report them in the methods and the figure legend.

Should a volcano plot use p values or FDR?

Use the FDR (for example Benjamini–Hochberg) when many genes are tested, because the FDR controls the expected proportion of false discoveries among the genes called significant.

How many replicates does a volcano plot need?

Three per group is a bare minimum for RNA-seq; five or more per group gives far more stable results. Power depends on effect size and variability.

Related guides

How to cite this page: StatFAS. (2026, November 7). Volcano Plot Tutorial: Step-by-Step in R, Python, SPSS and StatFAS. https://statfas.com/tutorials/volcano-plot.html