Venn diagram

Venn diagram

1. Venn Diagram to make Venn diagram

library(VennDiagram)
venn_list <- list(geneset1, geneset2,geneset3,geneset4)
names(venn_list) <- c('RNAseq_up','RNAseq_down','scRNAseq_up','scRNAseq_down')
venn.diagram(venn_list, filename ='venn.png', imagetype ='png', margin = 0.2, 
    fill = c('red','blue','yellow','green'), alpha = 0.30, col ='black', cex = 1, fontfamily ='serif', cat.cex = 1, cat.fontfamily ='serif')

46891581143372_.pic_hd.jpg

Commonly used parameters col: border color lwd: border line width fill: fill color alpha: transparency cex: label font size cat.cex: font size margin: marginal distance

Venn diagram does not support pdf format, if you want to export pdf:

venn<-venn.diagram(venn_list, margin = 0.2, filename = NULL,
    fill = c("#F8766D", "#00BFC4","#C77CFF","#7CAE00"), alpha = 0.50, col ='black', cex = 1, fontfamily ='serif', cat.cex = 1 , cat.fontfamily ='serif')
pdf(file="venn_plot.pdf")
grid.draw(venn)
dev.off()

2.UpSetR does Venn diagram

library(UpSetR)
listInput <- list(one = c(1, 2, 3, 5, 7, 8, 11, 12, 13), two = c(1, 2, 4, 5, 
    10), three = c(1, 5, 6, 7, 8, 9, 10, 12, 13))
upset(fromList(listInput), order.by = "freq", sets.bar.color = "grey")

image.png

3.venn makes a Venn diagram

venn(x, snames = "", counts, ilabels = FALSE, ellipse = FALSE, zcolor = "bw", opacity = 0.3, plotsize = 15, ilcs = 0.6, sncs = 0.85, borders = TRUE, box = TRUE, par = TRUE, ggplot = FALSE, ...)

Main parameters: x: input list snames: the name of each collection ilabels: display the label of the intersection ellipse: change the shape to an ellipse zcolor: color opacity: opacity cexil: font size cexsn: font size of the collection name label

install.packages("venn") #Install
library(venn) #import
venn(listInput, zcolor = "style", cexil = 1, cexsn = 0.8) 
# zcolor = "style sets the default color style, cexil = 1 changes the font size of the value label in the intersection area to 1, and the font size of the cexsn collection name label

image.png

Set ellipse = TRUE to force the shape to be an ellipse.

venn(listInput, ellipse = TRUE, zcolor = "style", cexil = 1, cexsn = 1)

image.png

Welcome to follow~

reference:

https://github.com/hms-dbmi/UpSetR https://nachtzug.xyz/2019/01/19/venn-diagram-with-R-venn-package/

Reference: https://cloud.tencent.com/developer/article/1607929 Venn Diagram-Cloud + Community-Tencent Cloud