# Chapter 5 Applications of Venn, Euler and Upset plot

To date, there are three major methods to display set relationships, Venn diagram, Euler diagram and UpSet plot . The UpSet plot is a state-of-art visualization technique for the quantitative analysis of sets , and support unlimited number of sets.

When the number of sets is very large, UpSet plot is more reasonable be choose. By contrast, Venn and Euler are both traditional approaches to finish this task. Euler diagram is area-proportional, and only show relevant relationships.

Since human eye is less sensitive to area than to color, we believe that using color filling to show the difference between different regions is more suitable for ordinary biomedical studies.

For example, ggVennDiagram support Venn plot up to 7 sets.

genes <- paste0("gene",1:1000)
set.seed(20210507)
x <- list(A = sample(genes,100),
B = sample(genes,150),
C = sample(genes,200),
D = sample(genes,250),
E = sample(genes,300),
F = sample(genes,350),
G = sample(genes,400))

but if we plot them, we will find it is difficult to separate the border of different sets in the plot (even with thick edges), especially for 7 and 6 sets Venn.

ggVennDiagram(x, label = "none", edge_size = 2) + scale_fill_distiller(palette = "RdBu")

ggVennDiagram(x[1:6], label = "none", edge_size = 2) + scale_fill_distiller(palette = "RdBu")

ggVennDiagram(x[1:5], label = "none", edge_size = 2) + scale_fill_distiller(palette = "RdBu")

By contrast, if we apply this large x to upset(), it will get:

library(UpSetR)
upset(fromList(x), nsets = 7)

In my opinion, this plot is better to show the intersection values between them.

### References

Conway, Jake R, Alexander Lex, and Nils Gehlenborg. 2017. UpSetR: An R Package for the Visualization of Intersecting Sets and Their Properties.” Bioinformatics 33 (18): 2938–40. https://doi.org/10.1093/bioinformatics/btx364.
Lex, A., N. Gehlenborg, H. Strobelt, R. Vuillemot, and H. Pfister. 2014. UpSet: Visualization of Intersecting Sets.” IEEE Transactions on Visualization and Computer Graphics 20 (12): 1983–92. https://doi.org/10.1109/TVCG.2014.2346248.