Because it's not always possible to use a Venn diagram (a circular one that could be made in R) to show overlaps between three or four sets, I'll suggest something a little different.

I came up with something I call an "Eulergrid" which shows a bar graph, where each bar is an element in the power set of intersected sets, and a grid of overlap cases underneath (*e.g.*, for three sets: A, B, C, A ∩ B, B ∩ C, A ∩ C, A ∩ B ∩ C).

The bar graph shows the overlap cardinalities between set intersections contained in the power set. The grid shows the intersection between one and more sets, and is aligned to the value shown in the bar graph column. The bar graph is sorted by overlap cardinality, presented from left to right, from least to greatest cardinality. (I leave out visualizing the empty set, although strictly speaking this is also a valid subset.)

While an Eulergrid is admittedly less intuitive to read than a circular Venn diagram, it can always show all true overlaps between all the sets, and without adding distortion or visual errors from "impossible" Venn overlaps.

The R script used to make Eulergrids will scale up to however many sets you need to show intersections for, but it will create an exponentially wider figure as the total number of permutations of intersections increase as a power of 2 (three sets have eight power set subsets, intersections of four sets have sixteen subsets; five sets have thirty-two subsets, etc.).

To demonstrate, here's an example of what an Eulergrid figure looks like:

The green denotes the count for that subset. Yellow coloring, in the context of this figure, represents cell-specific cardinality, *i.e.* the counts that are unique to a single cell type or dataset.

As a way to read this, for example, 42% of the total element overlaps over these five cells types involve SKNSH in some way. Of all those overlaps, roughly half can be assigned to SKNSH alone.

Here's the R code for `plotEulergrid.R`

:

<script src="<a href=" alexpreynolds="" 5531166"="">alexpreynolds/5531166"></script>

Here's a Perl-based wrapper to this R script, called `eulergrid.pl`

:

<script src="<a href=" alexpreynolds="" 5535721"="">alexpreynolds/5535721"></script>

Here's an example of calling the Perl wrapper on the command line, which was used to make the figure shown above:

```
$ ./eulergrid.pl \
--setNames=GM06990,HepG2,K562,SKNSH,TH1 \
--plotTitle="Footprint__overlaps__for__multiple__cell__lines\n(FDR__0.001)" \
--setCardinalities=212350,233552,270586,287731,240701,93351,64049,89860,110579,62852,96806,89476,62075,64644,90129,30893,51178,53416,29083,32041,51033,28922,28279,48629,27407,22805,23548,39400,22418,21029,17172 \
--setTotal=689952 \
--outputFilename=results/footprintOverlaps/overlaps.fdr0p001.112409.png \
--offCellColor="gray80" \
--onCellColor="springgreen4" \
--ctsCounts=65897,97624,173336,150753,91965
```

The option `--ctsCounts`

refers to the yellow coloring I describe up above, representing "cell-type-specific" counts.

Hopefully, this gives you some ideas or at least an understanding that Venn diagrams cannot always represent intersections between more than three sets (and sometimes not even between three sets).

Dear Payal, If you want venn diagram of any kind the '1' s and '0' might be confusing to create them. instead if you can convert your csv file such that '1' s replaced with respective id e.g NPAS4, FAM120C etc. and delete all '0' s; I can help you get what you want.

870