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

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!

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.

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()