#VizLikeAnArtist - Shape Mapping in Tableau

by Ben Moss

#VizLikeAnArtist

Shape maps are one method of representing geographical data, an example is highlighted below.

square-tiles

But why would you use a shape map over an actual geographic border map?

The reason is quite simple: the different sizes of the geographic areas lead to issues with the perception of colours. Darker but smaller shapes appear to be of similar colour to those that are larger but may be one or two tones lighter. Even worse, some small geographic areas may be completely missed. In other words ‘larger areas carry a greater visual weight’ (courtesy of Danny DeBelius).

The idea of shape mapping is to aid the interpretation process by rectifying the drawbacks of the previous mapping style by making each area the same size.

There are of course drawbacks with this method. Shape maps decrease the recognition of areas. People know where they live and usually the shape of the area they live in. They also know their location in contrast to surrounding areas. So of course changing the shape and normalising the size of these areas will hinder their ability to quickly identify locations.

Given the awesomeness that is geographic mapping in Tableau, shape mapping is slightly more time consuming as you have to create your maps, rather than a simple double click. I plan to overcome this hurdle by creating a repository on my public Google drive that contains shape mapping templates that others can use. See the end of the document for the link.

Below gives an example of a shape (a hexagon) map vs. geographic map by reviewing the number of crimes by local authority in London which I feel outlines the above problems well.

GeoHex

So how do you make a shape map? I will show you how I worked through creating the above in Tableau.

First of all you need to be artistic and create a template. I created my template in PowerPoint (other tools are available). Remember to be as accurate as possible about the location of these areas to help with the familiarity of the locations to your users. In my example I have also left a gap between the local authorities that are north and south of the River Thames, again this will help with resemblance.

 

Table

What I will say now is that our ‘shape map’ is actually just a scatter plot, with our points being represented by a shape, in this case, hexagons. You then fiddle around in tableau with the spacing by increasing/decreasing the size of the shape to give the right space between your objects.

Because we now know the underlying secret behind our shape maps we now need to create a data source that contains these points. To do this, think of your template as being plotted on a graph, we need to plot the mid points for each shape. For every shape to the right we add 0.5, for every shape upwards again we add 0.5.

For example the point for Hounslow from the template would be 1 (2nd column in from the right) and 3.5 (7 rows upwards). In my actual example I added an extra 0.5 to the row value to those areas north of the river to give the space between.

Once you have done this for all your areas it is now a simple case of importing your data into Tableau, dragging ‘row’ onto the rows shelf, ‘column’ onto the columns shelf, adding the ‘area’ (in my case Local Authority) to detail and then changing the marks to shape. Then change (a hexagon is not in the default shapes) and resize your shapes as you wish.

In mine I have joined my worksheet to another data source with local authority as the join, I have then added the number of crimes to colour.

Hex Gif

Remember this is possible for all manner of shapes; squares, circles, diamonds, anything! You just have to change your column and row data accordingly.

Here is a link to my public Google drive: https://drive.google.com/folderview?id=0B4PFXwIxeUahbWdSMnllVnRqM0E&usp=sharing

At present I only have information for US states and London’s local authorities. I will try and keep this repository up to date as I continue to find different shape maps in the Tableau community.

Feedback and questions welcome!

Ben

#VizLikeAnArtist

 

Thu 25 Feb 2016

Wed 24 Feb 2016