Venn2

Authors

[Editor] Hu Zheng;

[Contributors]

Note

Hiplot website

This page is the tutorial for source code version of the Hiplot Venn2 plugin. You can also use the Hiplot website to achieve no code ploting. For more information please see the following link:

https://hiplot.cn/basic/venn2?lang=en

A Venn diagram is a diagramthat shows all possible logical relations between a finite collection of different sets. These diagrams depict elements as points in the plane, and sets as regions inside closed curves. A Venn diagram consists of multiple overlapping closed curves, usually circles, each representing a set. The points inside a curve labelled S represent elements of the set S, while points outside the boundary represent elements not in the set S. This lends to easily read visualizations; for example, the set of all elements that are members of both sets Sand T, S ∩ T, is represented visually by the area of overlap of the regions S and T. In Venn diagrams the curves are overlapped in every possible way, showing all possible relations between the sets.

Setup

  • System Requirements: Cross-platform (Linux/MacOS/Windows)

  • Programming language: R

  • Dependent packages: venn

# Install packages
if (!requireNamespace("venn", quietly = TRUE)) {
  install.packages("venn")
}

# Load packages
library(venn)

Data Preparation

The loaded data is a collection of five gene names.

# Load data
data <- read.delim("files/Hiplot/179-venn2-data.txt", header = T)

# convert data structure
data_venn <- as.list(data)
data_venn <- lapply(data_venn, function(x) {
  x[is.na(x)] <- ""
  x <- x[x != ""]
  return(x)
})

# View data
head(data)
     Set1      Set2     Set3      Set4    Set5
1   ISG15      HES5     DVL1   MATP6P1 FAM132A
2  TTLL10  AURKAIP1 ARHGEF16   MIR551A    AGRN
3    HES4 LINC00982   OR4F16  C1orf222 WBP1LP6
4  OR4G4P    FAM87B      SKI   MIR200B  KLHL17
5 MND2P28       SKI   WASH7P LINC00115  FAM41C
6  FAM87B     GABRD    MEGF6    ATAD3B   PANK4

Visualization

# Venn2
col <- c("#E64B35FF","#4DBBD5FF","#00A087FF","#3C5488FF","#F39B7FFF")
venn(x=data_venn, opacity=0.8, ggplot=F, ilabels = TRUE, zcolor=col, box=F)
title(main = "Vene Plot (5 sets)", line = -1)
FigureΒ 1: Venn2

The closed curve of 5 colors represents 5 sets, and the number represents the number of overlapping or non-overlapping genes in multiple sets. For example, 8 in the sample figure represents 8 identical gene names in 5 sample sets.