On #MakeoverMonday this week I was impressed by a number of interactive submissions which combined dashboard actions with background images overlaid with data. I have no idea how you do this, so it’s time to learn. What am I on about? Check out my favourite example which was posted by Femke Goedhart.
An early viz I saw was published by Mark Bradbourne, and he was kind enough to take the time to summarise his approach in a blog post. After reading that post, I decided to see just how many guides were available online, as it seemed to be a common approach adopted this week. There are plenty of resources available:
- Tableau’s on-demand tutorials include this video (account required to view it)
- Bryant Howell wrote this comprehensive blog post
- The Interworks drawing tool can be accessed here, and it is accopanied by this short YouTube video:
- Brian Prestidge of The Information Lab shared this blog post, and he too took the time to create a video. This method leverages Alteryx and Adobe Illustrator, so is probably out of the reaches of many:
- charlesconsulting.co shared this blog post
- Ryan Sleeper wrote this post
- Another on-demand Tableau video shows how to plot data on a background image
That’s by no means an exhaustive list, but it seems to be a technique which is well documented. Let’s see if I can use this wealth of resources to plot something completely frivolous:
My first reference point was the final bulleted Tableau video. Let’s see how I get along. After finding the above image, I created the shell of an Excel file to use as a data source:
I’m planning to plot three sets of coordinates per “Section”, with each section being a part of the face. The 600×600 values in the first “Right ear” row are just to enable me to force Measures into the data source – they could be any number at all. If numbers aren’t there, then the X and Y fields will be imported as Dimensions.
Following along with the video, I then connected to the Excel file, clicked Sheet and then went Map > Background Images, before selecting my data set:
Next, I selected Add Image and browsed to the .png on my desktop. When that is first pulled in, it looks like this:
I don’t know why Tableau defaults to having the X Field as X and the Y Field as X, but obviously you need to fix this. Ultimately I want to plot my image as a square 600×600, and so my final settings are:
Note that the Right and Top values are 600 and not 60, I just can’t extend the width of the screen. When you OK that, nothing happens. You need to put your X Measure on Columns and Y on Rows. Then the image appears, and you’ll note the mark at 600×600 – that’s a consequence of my “dummy” value in the original data source to create the Measures.
So far, so good. Next is the laborious part. I need to annotate marks that I want to use as my plotted data points. I want three for each section, so a logical first point is the intersection of the side of the face and the base of the right ear. To do that, you just right-click the relevant point on the image, and select Annotate > Point:
That conveniently gives you the X and Y coordinates you need:
You can then pepper Mickey’s face with coordinates to enable you to properly populate the Excel data source, or just drag the end point of the line to pull through the coordinates of each point, one by one:
At this point I realised that three points per section is overkill, as the final point of the right ear would overlap with the first point of the “Top of head” section, so I trimmed my data points down and ended up with this:
I just went to a couple of decimal places as I’m inherently lazy. Once complete, I saved the Excel file and refreshed the data source:
Problems begin here. First of all, it looks like this after the refresh:
This is fine. Following along with the video I know I need to drag Section to detail. But what’s this? Uh-oh:
The marks for Top of head and Chin are OK, as they are unique values. In the data source I didn’t make the multi-point sections unique, so they get aggregated together and things mess up. They just need to be made unique in the source:
A final data refresh and we’re done – almost. Mickey’s left ear is cropped:
This is because the rightmost value of the x-axis coordinates is the 498.44 for “Left side 1”. I just need to fix the x-axis to end at 600:
And then I can proudly say that I have crudely mapped a cartoon mouse’s face in Tableau, which you don’t get to say every day:
I’ve learned something new again! Here’s the final worksheet for download if you want to take a look.