Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Visualize the intersections of overlapping sets
| ResourceFunction["VennGraphPlot"][{set1, set2, …}] plots a graph showing the number of shared elements among the sets. | 
| "Colors" | Automatic | colors to use for the primary sets | 
| GraphLayout | Automatic | the embedding used in laying out the graph | 
| "Labels" | Automatic | labels to use for the sets | 
| "Orders" | All | display the n–way intersections in the graph | 
| "TooltipSamples" | 10 | the number of samples from each set to display in the tooltip | 
| "TooltipRandomize" | True | whether to show random samples in tooltip | 
Visualize the intersections of three sets:
| In[1]:= |  | 
| In[2]:= | ![ResourceFunction["VennGraphPlot"][sets, "Labels" -> ToString /@ sets]](https://www.wolframcloud.com/obj/resourcesystem/images/ca3/ca349039-6552-4d66-9671-2f583615b168/7115555d28a17e6b.png) | 
| Out[2]= |  | 
Visualize the pairwise intersections of sets:
| In[3]:= | ![s = Alphabet[][[;; #]] & /@ Range[5]](https://www.wolframcloud.com/obj/resourcesystem/images/ca3/ca349039-6552-4d66-9671-2f583615b168/17df1628a028e2e3.png) | 
| Out[3]= |  | 
| In[4]:= | ![ResourceFunction["VennGraphPlot"][s, "Orders" -> 2]](https://www.wolframcloud.com/obj/resourcesystem/images/ca3/ca349039-6552-4d66-9671-2f583615b168/782d1355ccab638f.png) | 
| Out[4]= |  | 
Plot a Venn graph with different intersection orders:
| In[5]:= | ![sets = Range[1, 100, #] & /@ {5, 9, 15, 17, 4};
Manipulate[
 ResourceFunction["VennGraphPlot"][sets, "Orders" -> order], {order, {2, 3, 4, 5, All}}]](https://www.wolframcloud.com/obj/resourcesystem/images/ca3/ca349039-6552-4d66-9671-2f583615b168/06d1fd46504f4bfc.png) | 
| Out[6]= |  | 
You can change the colors used for the sets node with the "Colors" option:
| In[7]:= | ![ResourceFunction[
 "VennGraphPlot"][{{1, 2, 3, 4}, {2, 3, 4, 5}, {0, 1, 2, 3}}, "Colors" -> ResourceFunction["SampleColors"][104, 3]]](https://www.wolframcloud.com/obj/resourcesystem/images/ca3/ca349039-6552-4d66-9671-2f583615b168/1125564523ec51b7.png) | 
| Out[7]= |  | 
You can change the layout used with the GraphLayout option:
| In[8]:= | ![ResourceFunction["VennGraphPlot"][s, GraphLayout -> "CircularEmbedding"]](https://www.wolframcloud.com/obj/resourcesystem/images/ca3/ca349039-6552-4d66-9671-2f583615b168/16af924c0d9add64.png) | 
| Out[8]= |  | 
Show the size of the shared memberships between four political blocs:
| In[9]:= | ![cd = CountryData /@ {"FormerBritishColonies", "GroupOf8", "GroupOf15",
     "InternationalCriminalCourt"};
ResourceFunction["VennGraphPlot"][cd, "Labels" -> {"Colonies", "G8", "G15", "ICC"}]](https://www.wolframcloud.com/obj/resourcesystem/images/ca3/ca349039-6552-4d66-9671-2f583615b168/4d0a1528a1aeaa7c.png) | 
| Out[10]= |  | 
There is no lattice for totally independent sets :
| In[11]:= | ![ResourceFunction["VennGraphPlot"][{{1}, {2}, {3}}]](https://www.wolframcloud.com/obj/resourcesystem/images/ca3/ca349039-6552-4d66-9671-2f583615b168/738684c9174cc013.png) | 
| Out[11]= |  | 
The number of intersections can increase exponentially:
| In[12]:= | ![ResourceFunction["VennGraphPlot"][Range /@ Range[10]]](https://www.wolframcloud.com/obj/resourcesystem/images/ca3/ca349039-6552-4d66-9671-2f583615b168/1345932b61ed346a.png) | 
| Out[12]= |  | 
This work is licensed under a Creative Commons Attribution 4.0 International License