How to Make a Venn Diagram for Gene Lists and Other Data Sets

By Dr. Zubair Khalid, DVM, MS, PhD ·

How to Make a Venn Diagram for Gene Lists and Other Data Sets

A Venn diagram represents sets as overlapping closed curves, with each enclosed region standing for a distinct combination of membership. John Venn described the construction in 1880 in the Philosophical Magazine as a way to represent logical propositions [1]. In a genomics lab, the sets are usually gene lists: differentially expressed genes, ChIP-seq targets, proteomics hits, or any collection of identifiers you want to compare.

The appeal is that a Venn diagram answers a specific question at a glance: which items appear in which combination of lists, and how many appear in each combination. The risk is that the picture looks authoritative even when the underlying counts are wrong, the identifiers were never harmonized, or the region labels mix inclusive and exclusive counts. This guide covers the arithmetic, the labeling conventions, the tool choices, and the failure modes that matter when the figure ends up in a paper.

Quick Answer

  • A 2-set diagram has 3 regions (A only, B only, both). A 3-set diagram has 7 regions (3 unique, 3 pairwise-only, 1 all-three), plus the outside. In general, $n$ sets produce $2^n - 1$ regions, which is why diagrams become unreadable beyond about four or five sets.
  • Region counts are exclusive. "A and B only" excludes items that are also in C. Each set's total equals the sum of its regions.
  • For 3 sets, the union is the sum of all seven regions. Verify each set total against its region sum before you draw anything.
  • Harmonize identifiers and remove within-list duplicates before comparing. Symbol aliases, case differences, and Ensembl ID versus symbol mismatches silently shrink overlaps.
  • Past four or five sets, use an UpSet plot instead of forcing a diagram.

Step 1: Define the Sets and Harmonize Identifiers

Write down exactly what each list contains before you touch a drawing tool. A set is a collection of distinct items, so duplicates within a list must be collapsed first. If your RNA-seq results table has the same gene symbol twice because of isoform-level rows, the set has one element, not two.

Identifier harmonization is the step that quietly determines whether your overlap is real. Gene symbols change between annotation releases, differ in case, and have aliases. One list may use Ensembl IDs while another uses symbols, and some mappings are one-to-many. Any of these mismatches will produce a smaller overlap than the biology warrants, and the diagram will not warn you. Pick one identifier namespace, convert everything into it, and record which release you used.

State the thresholds that built each list. A list of "differentially expressed genes" is not a set until you say padj < 0.05 and |log2FC| > 1, or whatever cutoffs you applied. Two lists built with different thresholds are not comparable in the way the diagram implies.

Step 2: Count the Regions Correctly

For two sets, the regions are A only, B only, and A and B. For three sets, label them explicitly:

RegionMeaning
A onlyIn A, not in B, not in C
B onlyIn B, not in A, not in C
C onlyIn C, not in A, not in B
A and B onlyIn A and B, not in C
A and C onlyIn A and C, not in B
B and C onlyIn B and C, not in A
A, B and CIn all three

Every region is exclusive. The count in "A and B only" does not include the items in all three sets. This convention is what makes the arithmetic work:

$$|A| = |A \text{ only}| + |A \cap B \text{ only}| + |A \cap C \text{ only}| + |A \cap B \cap C|$$

The same identity holds for B and C. The union of all sets is the sum of the seven regions. If your region counts do not reproduce each set total, you have either double-counted or mislabeled a region.

Worked Example

Suppose you have three lists from a hypothetical multi-omics experiment: RNA-seq upregulated genes (16), proteomics upregulated proteins (13), and ChIP-seq targets (12). After harmonizing identifiers and removing duplicates, the region counts are:

RegionCount
RNA-seq only2
Proteomics only5
ChIP-seq only3
RNA-seq and proteomics only5
RNA-seq and ChIP-seq only6
Proteomics and ChIP-seq only0
All three3

Check each set total against its regions:

  • RNA-seq: 2 + 5 + 6 + 3 = 16
  • Proteomics: 5 + 5 + 0 + 3 = 13
  • ChIP-seq: 3 + 6 + 0 + 3 = 12

The union is 2 + 5 + 3 + 5 + 6 + 0 + 3 = 24 genes. Note that the proteomics and ChIP-seq only region is zero. A Venn diagram still draws that region, empty. An Euler diagram would omit it.

If you want to draw this without writing code, the Venn Diagram Maker on this site takes region counts and produces the figure. Enter the seven numbers above and verify that the set totals match before exporting.

Step 3: Choose Between Venn, Euler, and Area-Proportional Diagrams

A standard Venn diagram shows all $2^n - 1$ regions whether or not each contains items. An Euler diagram omits empty regions, which is often cleaner when zeros are common. The R package VennDiagram generates Venn diagrams with up to four sets and Euler diagrams with up to three sets [4].

Area-proportional diagrams size the circles and their overlaps so that visual area matches the counts. BioVenn was built specifically to draw area-proportional Venn diagrams from lists of biological identifiers [2]. For most 3-set data, circles cannot produce an exactly area-proportional diagram, which is a geometric constraint, not a software limitation. eulerAPE uses ellipses to achieve accurate area-proportional 3-set diagrams [3]. If exact proportionality matters for your figure, use a tool that draws ellipses and check the output against your counts.

For a 2-set comparison, circles can be area-proportional. For 3 sets, decide whether you need proportional areas or just correct labels. Many published figures are not area-proportional, and that is acceptable as long as the counts are printed in the regions and the reader is not misled by circle sizes.

Step 4: Handle More Than Four Sets

The region count grows as $2^n - 1$: 3 regions for 2 sets, 7 for 3, 15 for 4, 31 for 5. Beyond four or five sets, the diagram stops being readable, and the labels become impossible to place without ambiguity.

UpSet plots solve this by showing intersections as a matrix with bar charts of intersection size [5][6]. Each row is a set, each column is an intersection, and the bar height gives the count. You lose the intuitive overlap picture but gain a readable display of every intersection, including the large ones that a cluttered Venn diagram would hide. For a five-list comparison, an UpSet plot is usually the better choice.

Step 5: Test Whether the Overlap Is Larger Than Chance

An overlap count on its own says nothing about whether the overlap exceeds what random sampling would produce. That depends on the background, or universe, size: the number of genes that could plausibly have appeared in either list. A hypergeometric test or Fisher's exact test on a 2x2 table with the background count is the standard check. The table has cells for in A and in B, in A not B, not A in B, and neither.

Report the background you used. If the universe is all protein-coding genes, say so. If it is the set of genes with detectable expression in your samples, say that instead. The same overlap can be significant against one background and unremarkable against another, so the number is meaningless without it.

Common Mistakes

  • Mixing inclusive and exclusive counts. If you label a region "A and B" and put the all-three count there, the set totals will not add up. Fix: label every region with its full membership, including the "only" qualifier where it applies.
  • Forgetting to deduplicate within lists. Duplicate symbols inflate region counts and set totals. Fix: collapse each list to unique identifiers before counting.
  • Comparing identifiers in different namespaces. Ensembl IDs against symbols produce near-zero overlap. Fix: convert to one namespace and document the annotation release.
  • Omitting thresholds. A list without cutoffs cannot be reproduced or compared. Fix: state padj, fold-change, or whatever criteria built each list, in the figure legend.
  • Using a Venn diagram for six sets. The regions become unreadable and the labels overlap. Fix: switch to an UpSet plot.
  • Reporting overlap size without a background. The count alone does not support a claim of enrichment. Fix: run a hypergeometric or Fisher's exact test and report the universe size.

Limitations

Venn diagrams encode membership, not magnitude. A gene with a large fold change and one barely past threshold occupy the same region. If effect size matters for your question, the diagram will not show it.

The method assumes your sets are well-defined and comparable. Lists built with different thresholds, different reference annotations, or different detection sensitivities are not directly comparable, and the diagram will not reveal that mismatch. It will simply show a small overlap that reflects the pipeline, not the biology.

Area-proportional diagrams are geometrically constrained for three or more sets. Circles cannot always be arranged so that every region's area matches its count, which is why ellipse-based tools exist [3]. Even then, small regions may be visually indistinguishable, and a count of 1 and a count of 3 can look identical.

Statistical interpretation requires a defensible background. Choosing the universe after seeing the overlap invites bias. Decide the background before you run the test, and report it alongside the p-value.

Frequently Asked Questions

How many regions does a 3-set Venn diagram have?

Seven, plus the outside region. Three are unique to one set, three are shared by exactly two sets, and one contains items in all three. In general, $n$ sets produce $2^n - 1$ regions.

When should I use an UpSet plot instead of a Venn diagram?

When you have more than four or five sets, or when the intersections you care about are the large ones that a cluttered diagram obscures. UpSet plots show every intersection as a matrix column with a bar for its size [5][6].

What is an area-proportional Venn diagram?

A diagram in which the area of each circle and overlap is scaled to match the count it represents. BioVenn draws these from biological identifier lists [2], and eulerAPE uses ellipses to achieve accurate area-proportional 3-set diagrams because circles often cannot [3].

Do I need a statistical test for a Venn diagram overlap?

If you want to claim the overlap is larger than expected by chance, yes. A hypergeometric or Fisher's exact test on a 2x2 table with the background count is the usual approach. The overlap size alone does not support that claim.

What should I include in the figure legend?

The total n for each set, the thresholds used to build each list, the identifier namespace and annotation release, and a pointer to supplementary data with the item lists per region. Readers need the lists to check the overlaps.

References

  1. Venn J. On the diagrammatic and mechanical representation of propositions and reasonings. Philosophical Magazine, 1880
  2. Hulsen T, de Vlieg J, Alkema W. BioVenn: a web application for the comparison and visualization of biological lists using area-proportional Venn diagrams. BMC Genomics, 2008
  3. Micallef L, Rodgers P. eulerAPE: drawing area-proportional 3-Venn diagrams using ellipses. PLoS ONE, 2014
  4. Chen H, Boutros PC. VennDiagram: a package for the generation of highly-customizable Venn and Euler diagrams in R. BMC Bioinformatics, 2011
  5. Lex A, Gehlenborg N, Strobelt H, et al. UpSet: visualization of intersecting sets. IEEE Transactions on Visualization and Computer Graphics, 2014
  6. UpSet: Visualization of Intersecting Sets (PMC full text)

Related Articles