12/23/2014
Creating a Venn Diagram in Tableau


One of my students in the Spring semester data visualization class at the University of Cincinnati emailed me back in July asking about creating a Venn Diagram in Tableau. There are a number of threads on the Tableau forum here and here.

The Venn Diagram, sometimes referred to as a set diagram, was first introduced in 1880 by John Venn (more information here). Unfortunately, these chart types are not great visualization tools for comparing quantitative data. My first response to my student suggested alternative approaches to the visualization, but I got the sense from him that a strict client request was driving the desire for this chart type and changing the visualization design wasn't an option. I outlined an approach for him and then put my draft workbook in an archive folder. Since it's not a chart type that I considered very useful I wasn't really motivated to solve this problem and it sat idle.

At the Tableau conference in September I was talking with Ben Jones and KK Molugu and somehow the topic of Venn Diagrams came up. I described the approach, but I still had not completed an implementation of it in Tableau.

One logical approach to create a Venn Diagram is using Shapes, specifically circles. Rob Austin of Interworks used this approach creating a 3 circle venn diagram in Tableau here. The problem with this approach is that the size of the shapes is determined by the Size setting. This limits the ability to do the math calculations necessary to get exact overlap percentages and is relative to the view. You can see in Rob's approach that the numbers in the overlapping circles are not proportional to the area of the actual intersection. Instead of using Shapes, the approach I outlined was to plot each circle individually with 360 points so that the center position and the resulting overlap could be easily controlled. Once the 3 circles are plotted the position can be adjusted with parameters and the exact overlap of the circles can be calculated.

I completed this approach and then I converted it to a polygon shape. This created a cleaner circle vs. the 360 individual points and allowed for the circles to be shaded with color and transparency. The data set is very simple, just three fields.

   Circle - 1 to 3 representing the 3 circles
   Points - 1 to 360 points, one set for each circle
   Theta - 0 to 2pi in 360 increments, one set for each circle

The calculated fields are the equations used to create the X,Y points for the circle and to calculate the circle sectors. Click here for more information about the math behind these calculations.

The visualization below was built for demonstration and instructional purposes. This is not a recommendation for using this chart type, especially for quantitative comparisons.

Additional materials mentioned above: Rob Austin of Interworks created a 2 and 3 circle venn diagram using Shapes (circles). Check those out here and here.

My approach outlined above uses 3 equal size circles. The Radius field is hard coded in my example making all of the circles the same size. This could be adjusted using 3 different Radius fields and even using another set of parameters to correspond to the individual circle size, but the math calculating the overlap of the circles would need to be changed. I will outline this in a future post.

I hope you find this helpful. If you have any questions feel free to email me at Jeff@DataPlusScience.com.


Jeffrey A. Shaffer

Follow on Twitter @HighVizAbility


Learn About Tableau