Drawing Polygons on a Background Image

This post has for objective to help you to draw a custom polygon on a image background in Tableau Desktop. I assume you have 10 mins ahead of you and have a Tableau Desktop installed. Difficulty level. Beginner/Intermediate

Before We Go...

The final result first:

Yes, I like to start by the end. Here is what we are trying to achieve in Tableau:

saputostadium2012-topaerialview

Step 1: Some Data...

Yes, you need something to analyse... It can be anything as long as it make sense to plot something on top of that image. In our example let's make a simple assumption. I am responsible of Ticket Sales in a Stadium and I need to see where I sell my tickets. Of course I can use a simple bar Chart but a background image of my staduim would make it easier for me to see if some sections/part of the Staduim is behaving differently than the rest.

The dataset I am using is available here and have been created just for the sake of this exercise (therefore simplified). It look like this:

 

Section of the Stadium        ||     Number of Sales

Aisle A - Low Level           ||                2798

Aisle A - Top Level           ||                6191

Aisle B - Low Level           ||                3563

 

Link to the data set.

 

Step 2: An Image. Any Image

Find the image you need to draw on. I took my image here. You can use anything else if drawing a custom polygon on a empty is not very useful to you.

 

Step 3:  Draw our polygons on our image.

At this stage, we have an image and some data. Now we need to tell Tableau where and how our polygons will be overlaid on our background image. In order to do that you need a dataset that will contains the coordinate of your polygons (yes every single point of our polygons will need to and X & Y Coordinate.). Don't worry, I made this very easy for you thanks to this tool called draw your Tableau polygon online. It is free to use and you don't need any codding skills.

 

TABLEAU POLYGON DRAWING ONLINE

  
Some tips for using the Tool:
- To close Shape, Right Click!
- If your point doesn't appear when you left click it's because you are moving your mouse when clicking.
- Use Different colors for your Shapes
- Name your Shapes like it appears in your dataset.

You should have something like this when you have finished your first Shape:

07-07-2016 00-54-57

Make sure you name your shapes as it appears in your dataset (Case Sensitive!).

07-07-2016 00-54-35

Once you have all your shapes click on "Output Polygons" and the tool will generate the X & Y Shape coordinates for you.

07-07-2016 01-09-15

Keep note about the background image settings in Tableau. We'll need it later on.

The Tableau Magic

Alright at this stage we have two datasets. One with our polygons, one with our original data.

Let's start Tableau and create our polygons on our background image. The first step will be to output our shapes in Tableau without any image in the background.
Connect to your Shape file and double click on X & Y. Change the mark type to Polygons., put the Path ID in the Path Shelf, Identifier in Details.

07-07-2016 01-11-49

You should end up with this:
07-07-2016 01-12-14

Our last step is simply to tell Tableau to use our background image instead of the default white canvas like this:

07-07-2016 10-50-32

07-07-2016 10-50-47

So now we have our shapes but our data are not connected to it. Let's do some Tableau Blending to join those two data sets.
Open a new data connection and this time connect to your Excel file that contains how many tickets you sold. To make the connection simply rename in Tableau the "Identifier" of your polygones dataset to match what you have in your own dataset, in our example "Stadium Section". Drop any measure on the color shelf from your datset.

Tadam:

Did you miss something? No worries, here is all the file you need attached.

Stadium - Tickets
Tableau Dashboard

adrien-charles

Before, I was the "Excel Guy". I became "the Tableau guy" since I used this product for the first time 2 years ago. Certified on Tableau Desktop & Server with 50k+ Views on Tableau Public, I am a real Tableau fan who loves to share my discoveries & tips. I am a native French speaker, please excuse some weird sentences you may find :).

Leave a Reply

Your email address will not be published.