<p>Since you are in R, consider using the UpsetR library.  It doesn't make Venn diagrams but it helps to visualize overlaps between any number of groups.</p>
<p><a href="http://gehlenborglab.org/research/projects/upsetr/#:%7E:text=UpSetR%20is%20an%20R%20package,based%20on%20groupings%20and%20queries" rel="nofollow noreferrer">http://gehlenborglab.org/research/projects/upsetr/#:~:text=UpSetR%20is%20an%20R%20package,based%20on%20groupings%20and%20queries</a>.</p>

CC BY-SA 4.0
2021-01-25T22:02:01.930Z
2021-01-25T22:02:01.930Z
swbarnes2
<p>You might consider different ways of using the <code>venneuler</code> package. I'm not super thrilled with its usability (or with the accuracy of the overlaps), but you can get it to make custom Venn diagrams.</p>
<p><a href="https://stat.ethz.ch/pipermail/r-help/2010-May/239639.html" rel="nofollow noreferrer">Here</a> is a thread with some suggestions along these lines.</p>
<p>Below is some sample R code that I slightly modified from an old project that I used to make a 3-category Venn diagram.</p>
<p>I didn't run this to make sure that it works because of an irritating Java dependency issue on my OSX laptop that I don't feel like fixing right now, but as long as you have a JDK on your machine and can install the packages it <em>should</em> work.</p>
<pre><code># note irritating rJava dependency of venneuler
library(plotrix)
library(venneuler)

#A-B sharing: 200414
#B-C sharing: 17561
#A-C sharing: 16764
#All share 14201

# get coordinates for circles- replace as needed
# this function is supposed to plot stuff, but doesn't actually
ven = venneuler(c(C=48147-17561-16764+14201, 
                  B=347181-17561-200414+14201, 
                  A=325971-200414-16764+14201, 
                  &quot;C&amp;B&quot;=17561, &quot;B&amp;A&quot;=200414, &quot;C&amp;A&quot;=16764, &quot;A&amp;B&amp;C&quot;=14201))

cats = c('A','B','C')

# note- this following only shows up in the .pdf printer, not in the X11 utility plotter
pdf('venn.pdf')
plot(c(-.5,1.5), c(-.5,1.5), type='n', xaxt='n', yaxt='n', bty='n', xlab='', ylab='')
draw.circle(ven<span class="math-container">$center[1,1], ven$</span>center[1,2], ven<span class="math-container">$diameters[1],
        col = hsv(1,1,1,.5))
draw.circle(ven$</span>center[2,1], ven<span class="math-container">$center[2,2], ven$</span>diameters[2], 
            col = hsv(.5,1,1,.5))
draw.circle(ven<span class="math-container">$center[3,1], ven$</span>center[3,2], ven$diameters[3],
            col = hsv(.1,1,1,.5))

text(ven<span class="math-container">$center[1,1]+.065, ven$</span>center[1,2], labels=cats[3], cex=1.3)
text(ven<span class="math-container">$center[2,1], ven$</span>center[2,2]-.2, labels=cats[2], cex=1.3)
text(ven<span class="math-container">$center[3,1], ven$</span>center[3,2]+.2, labels=cats[1], cex=1.3)

dev.off()
</code></pre>

CC BY-SA 4.0
2021-01-26T19:11:19.097Z
2021-01-26T19:45:59.967Z
2021-01-26T19:45:59.967Z
Maximilian Press
<p>From my microarray data I have selected three subsets of probes. I would like to display these subsets as a Euler diagram to visualize the overlaps, but am struggling with inputting the combinations into Eulerr. All three subsets need to be nested within the full set of probes; one subset is fully contained within another, and the third overlaps with the other two. Is there a package into which I could feed the vectors of probe names and let it determine the overlaps for me? Many thanks in advance!</p>

<r>
how to easily make complex Euler/Venn diagrams in R?
# how to easily make complex Euler/Venn diagrams in R?

(Asked by: username_0 on 2021-01-25)

From my microarray data I have selected three subsets of probes. I would like to display these subsets as a Euler diagram to visualize the overlaps, but am struggling with inputting the combinations into Eulerr. All three subsets need to be nested within the full set of probes; one subset is fully contained within another, and the third overlaps with the other two. Is there a package into which I could feed the vectors of probe names and let it determine the overlaps for me? Many thanks in advance!

**Tags:** r

---

## 2 answers

### Answer by username_1 on 2021-01-25. Score: 2

Since you are in R, consider using the UpsetR library. It doesn't make Venn diagrams but it helps to visualize overlaps between any number of groups.

[http://gehlenborglab.org/research/projects/upsetr/#:~:text=UpSetR%20is%20an%20R%20package,based%20on%20groupings%20and%20queries](http://gehlenborglab.org/research/projects/upsetr/#:%7E:text=UpSetR%20is%20an%20R%20package,based%20on%20groupings%20and%20queries).


---

### Answer by username_2 on 2021-01-26. Score: 0

You might consider different ways of using the venneuler package. I'm not super thrilled with its usability (or with the accuracy of the overlaps), but you can get it to make custom Venn diagrams.
Here is a thread with some suggestions along these lines.
Below is some sample R code that I slightly modified from an old project that I used to make a 3-category Venn diagram.
I didn't run this to make sure that it works because of an irritating Java dependency issue on my OSX laptop that I don't feel like fixing right now, but as long as you have a JDK on your machine and can install the packages it should work.
# note irritating rJava dependency of venneuler
library(plotrix)
library(venneuler)

#A-B sharing: 200414
#B-C sharing: 17561
#A-C sharing: 16764
#All share 14201

# get coordinates for circles- replace as needed
# this function is supposed to plot stuff, but doesn't actually
ven = venneuler(c(C=48147-17561-16764+14201, 
                  B=347181-17561-200414+14201, 
                  A=325971-200414-16764+14201, 
                  "C&B"=17561, "B&A"=200414, "C&A"=16764, "A&B&C"=14201))

cats = c('A','B','C')

# note- this following only shows up in the .pdf printer, not in the X11 utility plotter
pdf('venn.pdf')
plot(c(-.5,1.5), c(-.5,1.5), type='n', xaxt='n', yaxt='n', bty='n', xlab='', ylab='')
draw.circle(ven$center[1,1], ven$center[1,2], ven$diameters[1],
        col = hsv(1,1,1,.5))
draw.circle(ven$center[2,1], ven$center[2,2], ven$diameters[2], 
            col = hsv(.5,1,1,.5))
draw.circle(ven$center[3,1], ven$center[3,2], ven$diameters[3],
            col = hsv(.1,1,1,.5))

text(ven$center[1,1]+.065, ven$center[1,2], labels=cats[3], cex=1.3)
text(ven$center[2,1], ven$center[2,2]-.2, labels=cats[2], cex=1.3)
text(ven$center[3,1], ven$center[3,2]+.2, labels=cats[1], cex=1.3)

dev.off()


---

