YuLab-SMU / ChIPseeker

:dart: ChIP peak Annotation, Comparison and Visualization
https://onlinelibrary.wiley.com/share/author/GYJGUBYCTRMYJFN2JFZZ?target=10.1002/cpz1.585
219 stars 74 forks source link

Use ggplot methods to plot venn #196

Closed MingLi-929 closed 1 year ago

MingLi-929 commented 1 year ago

This PR add two new methods to plot venn. The first is to use ggvenn to plot, which can only four sets in maximun.

files <- getSampleFiles()
library(TxDb.Hsapiens.UCSC.hg19.knownGene)
txdb <- TxDb.Hsapiens.UCSC.hg19.knownGene
peakAnnoList <- lapply(files, annotatePeak, 
                       TxDb=txdb,tssRegion=c(-3000, 3000))
genes <- lapply(peakAnnoList, function(i) 
  as.data.frame(i)$geneId)

vennplot(genes,by = "ggvenn")

tt As the picture above, the list has 5 elements ,but only 4 Sets are plotted, which prove the limit of ggvenn

We introduced ggVennDiagram to solve this problem.

vennplot(genes,by = "ggVennDiagram")

tt

We can also make full use of the robust function of ggVennDiagram to adjust details in the picture.

vennplot(genes,by = "ggVennDiagram",label_percent_digit = 2)

tt since the ggVennDiagram use ggplot2 grammmer, we can use ggplot2 to adjust the picture

vennplot(genes,by = "ggVennDiagram",label_percent_digit = 2) +
  scale_fill_distiller(palette = "RdBu")

tt