Delta._.43
Delta._.43

Reputation: 90

How can I create a Linear Venn diagram in R?

I want to create a linear Venn diagram in R, something like -
Example:

I know we can use GGVenn or VennDiagram in R but they only produce compact Venn diagrams like the following -

library(ggvenn)
ggvenn(list('S1' = LETTERS[1:10],'S2' = LETTERS[5:20],'S3' = LETTERS[15:26]), c("S1","S2","S3"))

This generates -
GGVenn Diagram


My original data is also text, so the problem applies directly. Any ideas or solutions?

Upvotes: 2

Views: 212

Answers (1)

Maël
Maël

Reputation: 52049

You can use the VennDiagram package (I added a bit more to make it prettier):

library(VennDiagram)
x = list('S1' = LETTERS[1:10],'S2' = LETTERS[5:20],'S3' = LETTERS[15:26])
venn.diagram(x, "test.png", 
             category.names = c("S1","S2","S3"),
             cat.fontface = "bold",
             cat.default.pos = "outer",
             fill = c("purple", "yellow", "green"),
             cat.pos = c(-27, 27, 135),
             cat.dist = c(0.055, 0.055, 0.055))

enter image description here

Upvotes: 2

Related Questions