A Venn diagram (also called primary diagram, set diagram or logic diagram) is a diagram that shows all possible logical relationships between a finite collection of different sets. Each set is represented by a circle. The circle size represents the importance of the group. The groups are usually overlapping: the size of the overlap represents the intersection between both groups.
<head> <!-- Include the CanvasXpress library in your HTML file --> <link rel="stylesheet" href="https://www.canvasxpress.org/dist/canvasXpress.css" type="text/css"/> <script src="https://www.canvasxpress.org/dist/canvasXpress.min.js"></script> </head> <body> <!-- Create a canvas element for the chart with the desired dimensions --> <div> <canvas id="canvasId" width="600" height="600"></canvas> </div> <!-- Create a script to initialize the chart --> <script> // Create the data for the graph var data = { "venn" : { "data" : { "A" : 340, "AB" : 639, "ABC" : 552, "ABCD" : 148, "ABD" : 578, "AC" : 456, "ACD" : 298, "AD" : 257, "B" : 562, "BC" : 915, "BCD" : 613, "BD" : 354, "C" : 620, "CD" : 143, "D" : 592 }, "legend" : { "A" : "List 1", "B" : "List 2", "C" : "List 3", "D" : "List 4" } } } // Create the configuration for the graph var config = { "graphType":"Venn", "vennGroups":"2" } // Call the CanvasXpress function to create the graph var cX = new CanvasXpress("canvasId", data, config); </script> </body>
library(canvasXpress) canvasXpress( vennData=data.frame(A=340, AB=639, ABC=552, ABCD=148, ABD=578, AC=456, ACD=298, AD=257, B=562, BC=915, BCD=613, BD=354, C=620, CD=143, D=592), vennLegend=list(A="List 1", B="List 2", C="List 3", D="List 4"), graphType="Venn", vennGroups=2 )