# Visualization - Exotic - Venn

A Venn diagram illustrates relationships between and among two or more variables using intersecting circles. The diagram is intuitive to interpret but struggles with complicated data sets.

A *Venn Diagram* illustrates relationships between and among two or more variables using intersecting circles. The diagram is intuitive to interpret but struggles with complicated data sets.

## Example

The first step is to make sure your variables are set up correctly. Each variable must be a binary variable (Nominal: Mutually exclusive categories), with a value of either *1* or *0* for each category. A correctly formatted table of bubblegum preferences is shown below. The example uses four of the flavors.

It is important to note that Venn diagrams can only perfectly depict the intersection of three or fewer variables. Any more and the diagram becomes an approximation.

### Create a Venn Diagram in Displayr

- 1. Go to
**Insert > Visualization > Venn Diagram** - 2. Under
**Inputs > DATA SOURCE > Variables in ‘Data’**, drag your variables into the box

## Object Inspector Options

The following is an explanation of the options available in the Object Inspector for this specific visualization. Refer to Visualization Options for general chart formatting options.

### Inputs

**Data source**- The input data can come in the following forms:
**Binary indicator variables (Variables or a Question/Variable set)**where the variables indicate which cases are included in which sets.**Table or pasted data of binary indicators (zero or one)**with the cases along the rows and sets along the columns.**R Output**that contains nested lists indicating the various set overlaps, as shown in the example below.

- The input data can come in the following forms:

### Chart

**DATA LABELS****Data label font size**The font size of the labels drawn within the circles.

**how as percentages**Computes percentages when the data is provided as binary variables.

**HOVER****Number Type**How the numbers appear when the user hovers their mouse over them (Automatic, Percentages, Number).

**Decimal places**. The maximum number of decimal places to show.

## Technical details

- Minimizes sum of squared residuals to find the best overlap. Where no diagram appears, it is likely that there is a problem with the inputs.
- If resizing a Venn diagram, it is necessary to press the
**Calculate**button to have it redraw. - There are few options for customizing Venn diagrams (e.g., there is no way to modify the font family).

## More Information

## Acknowledgements

The Venn diagram is computed using the R package `d3vennR` by Kenton Russell, which is in turn based on R `d3.js` by Ben Frederickson.

## Code

```
{
"formChartType": "Venn",
"formStackSeries": false,
"formSmallMultiples": false,
"formAsPercentages": false,
"formScatterLabelType": "As hover text"
}
```