A simple alternative to the traditional Venn diagram. It depicts each overlap as a separate bubble with area proportional to the overlap size.

1 2 |

`sets` |
list of vectors to overlap. If list contains more than 3 elements only the first 3 are used. |

`percentage` |
logical showing if percentages or raw numbers are displayed |

`colors` |
vector of colors for the bubbles, see details on specifying that |

`fontsize` |
fontsize used for the numbers in the bubbles |

`main` |
title of the plot |

`scale` |
a scaling factor to adjust the base triangle size when the plot does not fit the window well. |

`add` |
logical determining if the figure is added to exixting plot or if a new plot is initialized |

Colors can be specified as vector. For 2 set case a 3 element vector is required with colors for: Set1, Set2 and Set1 & Set2 correspondingly. For 3 set case a 7 element vector is required with colors for: Set1, Set2, Set3, Set1 & Set2, Set1 & Set3, Set2 & Set3 and Set1 & Set2 & Set3 correspondingly.

Raivo Kolde <rkolde@gmail.com>

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | ```
bvenn(list(Set1 = sample(letters, 14), Set2 = sample(letters, 9)))
bvenn(list(Set1 = sample(letters, 16), Set2 = sample(letters, 12), Set3 = sample(letters, 7)))
# Adding colors
bvenn(list(Set1 = sample(letters, 14), Set2 = sample(letters, 9)), colors = c("red",
"green", "yellow"))
bvenn(list(Set1 = sample(letters, 16), Set2 = sample(letters, 12), Set3 =
sample(letters, 7)), colors = c("red", "blue", "yellow", "purple", "orange", "green",
"brown"))
# Adjust the triangle size
bvenn(list(Set1 = sample(letters, 16), Set2 = sample(letters, 12), Set3 =
sample(letters, 7)), colors = c("red", "blue", "yellow", "purple", "orange", "green",
"brown"), scale = 0.7)
# Combine several diagrams using grid graphics
vplayout = function(x, y){
return(viewport(layout.pos.row = x, layout.pos.col = y))
}
grid.newpage()
pushViewport(viewport(layout = grid.layout(ncol = 2, nrow = 2)))
for(i in 1:2){
for(j in 1:2){
pushViewport(vplayout(i, j))
bvenn(list(Set1 = sample(letters, 16), Set2 = sample(letters, 3+ 3*j), Set3 = sample(letters, 7)), add = TRUE, fontsize = 10)
upViewport()
}
}
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.