I have a list with 7 sets of data. The following code
genes <- paste("gene",1:1000,sep="")
x <- list(
A = sample(genes,300),
B = sample(genes,525),
C = sample(genes,440),
D = sample(genes,350),
E = sample(genes,100),
EE = sample(genes,120),
G = sample(genes,102))
library(ggvenn)
ggvenn(x, stroke_size = 0.5, set_name_size = 4)
produces the Venn Diagram of them, but I obtained only 4 sets in the resulting plot:
How do I get the Venn Diagram of all the sets? Moreover, I would like the elements that are inside each set to be listed (for example the first ten elements of each set, since there are many).
To draw your diagram use venn::venn(x)
from the venn package. However, to obtain the elements inside use attributes(gplots::venn(x, show.plot = FALSE))$intersections
from the gplots package.
If you are only interested in the first 10 elements, this would work: sapply(attributes(gplots::venn(x, show.plot = FALSE))$intersections, function(x) x[1:10])