Wrestling with Tableau’s Polygon Mapping

Darcy Vance
8 min readOct 18, 2019

--

I could not, for the life of me, find a simple tutorial regarding this incredibly powerful feature of Tableau.

So I thought I’d try my hand at writing so that the next person wanting to learn this (or heaven forbid, the next time-constrained data viz consultant needing this information urgently), doesn’t have to trawl through message boards and answer forums, and can get building sooner.

Tableau’s Polygon chart type is an incredibly powerful tool for any data viz professional. Most of the insane dashboards for Makeover Monday and crazy, “Tableau-breaking” feature pieces (like this one by Frances Jones), use Polygon Mapping in some way.

3D “Wireframe” Path Model, 3D Polygon Model and Density Map of the Sydney Opera House — Credit: Frances Jones

But beyond fancy shapes and 3D monuments, Polygon mapping can also make the difference in professional visualisation development. Let’s have a look at a demo, and then we can look at some professional use cases.

The Demo

A bit of context:

I’ve always been a fan of professional wrestling. If Game of Thrones was a soap opera, told entirely through interpretive dance, and played out weekly over the span of decades, it would be closing in on WWE’s market share of the sport.

“The Heartbreak Kid” Shawn Michaels performing a high-risk manoeuvre on “Mankind” Mick Foley.

And I’m not using the word “sport” lightly. The performers that involve themselves in this amalgamation of sport and entertainment consistently place themselves in dangerous situations for the benefit of the live, and television, audience. The injuries that can result from this are as real as in any other sport.

I wanted to try and visualise the injuries sustained by some of these performers, as both a training exercise in Tableau, but also due to my own curiosity. This is how I did it:

Step 0: Understanding the data

First, we must understand what is required for polygons to work in Tableau.

Tableau's Polygon mapping requires “an ordered, enclosed sets of X, Y coordinates”. This is a fancy way of saying that, in order to draw a shape on a plane, we require:

  • A number of X, Y coordinates
  • An order that these X, Y coordinates occur
  • And that the set needs to be completed (i.e. the last X, Y value should be the same as the first)
Example: Required data to create the above quadrilateral. Notice there are five values, as we have “completed” the shape by returning to the first X, Y position.

Now, this can be done in any way you like, and it’s relatively easy when creating basic shapes. But as soon as we want to replicate complex shapes, we require some help. This is where the InterWorks Drawing Utility for Tableau comes in.

This is a free, browser-based piece of software that allows you to plot points, paths and polygons on top of any image you like. For our example, to better understand the patterns of injuries for professional wrestlers, we are going to represent our data in the form of the human body.

Step 1: Creating our polygons

  1. Load your selected image into the InterWorks Drawing Utility for Tableau. (I am using current Universal Champion Seth Rollins as my polygon model, but you can use any image you like.)
  2. Under Drawing Options, select Polygons and check “Snap to Existing Points” and “Show Guide Line”. (If mapping mainly straight, rigid objects, “Align with Previous Points” will allow perfect 90° angles.)

3. Start drawing polygons. This is as simple as clicking around the areas of the image that you wish to map. One of the body parts listed in my injury statistics was “Elbow and Forearm”. As you begin your path, you will see the data being generated in the table (or as text, if you’ve selected “CSV”) below Point Data.

Once you finish a polygon, you will notice that the tool fills in the space to make it clear what has been mapped so far. If you have selected “Snap to Existing Points”, you can also use the existing points for new polygons to ensure all edges match correctly.

Once a polygon is completed, you can also click and drag points to change their location. This massively reduces time in fixing up intricate details later on.

After we’ve mapped all of our polygons, we can “Copy” the table data and paste this into Excel or some other tool. (I used Excel over a text editor to consolidate all of my data — more on this to come).

Step 2: Displaying our polygons

Now that we have our Shape ID, Point ID, X and Y coordinate data. Constructing the polygons in Tableau is easy!

Simply change the Graph Type to “Polygon” and you will see the new Mark Type “Path”. The path to which this is referring is looking for the order of the points provided, to be able to plot them accurately on the X, Y plane.

Drag X and Y to Rows and Columns, Point ID to Path and Shape ID to Detail.

And there you have it! Polygon mapping in Tableau!

But if all we wanted to do was draw and image on an X, Y plane, we wouldn’t need Tableau. And we aren’t exactly generating any insights from this recreation of an image. We need data!

Step 3: Constructing our data

I retrieved some data on injuries in professional wrestling and it looked like this.

We have a two-value hierarchy of Body Group (Upper Extremity, Lower Extremity, Trunk and Head & Neck), and then this group split into Body Part, followed by a raw count of injuries over the study’s life cycle.

Seeing as we already have Interworks data with a value representing each polygon (ShapeID), I saw creating an intermediate table to map Body Part to ShapeID as the most simple solution.

So once we jump into Tableau, we map “Interworks.ShapeID” to “PolygonMapping.ShapeID” and “PolygonMapping.BodyPart” to “ResearchData”.”BodyPart”.

We now have a connection between our polygons and the data we want to display!

Step 3: Adding context through background images

We do still have one problem though. Looking back at what we have in Tableau so far. We can see that Seth’s title belt is being treated as a polygon (technically another body part).

For people without context, they may not understand what this shape is or they may mistake it for a part of the body. Additionally, simply removing the polygon through filters doesn’t particularly help.

Now we have a big gash through the centre of our figure, and while this would be one hell of an injury, it’s not accurate to what we are trying to visualise.

Luckily, we can add a Background Image to the sheet to give context.

Simply go to Maps > Background Images > *Your Data Source*, and select the image you want to underlay. For our example, I have simply painted out most of Seth, from the image, leaving the Universal Championship belt.

Once we upload our image, give the X and Y margins to denote scale, and change the opacity, the output we are left with provides context without sacrificing any of the data points we wish to display.

Step 4: Visualising the data

Now that we have generated and displayed our polygons, constructed and connected our data sources, and added context to the image, the only part left is to visualise our results.

Drag your measure to the Colour mark type and viola!

Not only do we have a cool viz, but we can immediately make connections and gain insight.

While before we were focusing on “Body Group” in our data, by visualising it in a natural way, we can see that injuries are not localised in that way. Rather, they are most serious over the performers’ joints (knee, wrist, shoulder, elbow/forearm and ankles). This is something that we may not have immediately understood by looking at raw data or conventional visualisations, like bar and column graphs.

Professional Use Cases

I’ll admit, I highly doubt I, or anyone else, will ever make a living by visualising professional wrestling (if you do, let me know), but this feature has a wide variety of use cases.

The ability to visualise data in it’s natural, physical form, takes advantage of neural pathways and connections that are already available in humans. Mapping the human body is an example of this. We are able to immediately and accurately identify patterns. correlations and potential causes to issues involving the human body.

Some other use cases include:

Custom Floorplan Visualisations

By using a customer’s own floorplan as a template, future climate control systems could be customised to an individual dwelling (with the above example displaying temperature data captured by IoT-enabled devices inside a residential dwelling).

Additionally, similar implementations could use floorplans of shopping centres or airports to display spending trends and foot-traffic patterns.

Water Quality Visualisation Using Spatial Polygons

Mockup of water quality across the Lane Cove river and inner harbour region of Sydney Harbor.

As Tableau allows for the addition of custom spatial regions, the Interworks “Maps” option is very powerful. This makes the creation of custom, intricate polygons easy.

In the above example, part of the Lane Cove River and inner Sydney Habour have been given custom regions that local councils or organisations may want to keep an eye on.

By visualising the data in a physical representation, rather than by bar charts and dot plots, we would more easily point out sources of poor water quality and identify the flow patterns in these systems.

And there you have it. If you have any cool use cases to share, let me know and I can add them to the post.

If you have any further questions, don’t hesitate to reach out.

--

--

Darcy Vance

Darcy is a Data Analyst and Consultant for Deloitte Australia.