When to use shape maps in data visualisation: part 2 of a great big guide

maps xkcd

xkcd’s take on mapping, via Duarte Romero

In a previous post I explained some of the considerations in deciding to use a map in data visualisation, and went into detail about mapping points and heatmaps. In this second part, taken from the MA in Online Journalism at Birmingham City University, I’m going to look at other types of maps: shape-based maps and image maps.

Mapping shapes

A more ambitious alternative to mapping points is to map shapes: in other words, instead of each data point being placed on a specific point on a map, instead different areas on that map are drawn and coloured/labelled according to the relevant data.

Shapes can be anything: you can have a map with shapes for each country in the world or a particular continent; or you can have a map with shapes for each county in the UK, or each constituency (voting region), or local authority. Or police authority area. Or health authority.

This is particularly useful if your data does not relate to geographical points (a specific location with its own latitude and longitude) but rather to broader geographical areas, such as a town or city, region or country, or an administrative area.

And data often will only relate to areas: unemployment rates, inflation and health data will all relate to areas. You are not going to get data which shows you the location of every sick person, unemployed person, or expensive loaf of bread.

If you are to be accurate in representing these figures, shapes are the way to do it.

But they are also harder to ‘draw’ than points on a map.

This is because shapes are actually data too: a description of the coordinates and paths needed to draw each shape.

As a result, drawing a map with shapes invariably involves merging data: your data about those places; and the data containing the descriptions of those shapes.

This second set of data is often called ‘shape files’. The mapping tool OpenHeatMap, for example, has a number of shape files stored in its database, including shapes for countries, US states, UK constituencies and authorities, and administrative regions in New Zealand, Mexico, Ireland, and other places.

carbon emissions map

OpenHeatMap’s Pete Warden uses shapes to show carbon emissions

This means that you can upload your own data and mix it with those shapes to generate maps that combine the two: shapes coloured according to a specified field in your data.

The launch of Google Fusion tables in 2009 made shape files accessible to a much wider userbase than ever before. It was closed in 2019 but visualisation tools like Datawrapper and Flourish made it even easier to visualise shapes by having the shapes of many administrative regions (for example US states or UK local authorities) built-in. Tableau and QGIS also provided the facility to use your own shapes to create maps.

Some tools use languages such as KML (Keyhole Markup Language) or SHP (shape files) to describe shapes. This means if you need to find the shapes to combine with your data, to create a map, then it’s much easier to do so.

Here, for example, Simon Rogers lists 16 useful Fusion Tables files for mapping shapes.

Another option is to use a JavaScript library for mapping which has the shapes you need. Or to use more advanced mapping tools like GIS.

The final option is to draw the shapes yourself. In Google Maps Engine Lite once you have drawn your maps (shapes, points, or routes) you can export as KML.

There’s also another option which doesn’t involve shape files at all: you can find an image showing all the regions you need, then add a layer of interactivity to convert that into an image map, as described below.

Colouring map shapes

When choosing to colour-code shapes in a map you need to consider the same issues as outlined above with regard to points: don’t choose too many colours, and keep the story clear and/or useful.

It is a good idea to use a tool like Color Brewer to help you choose the colour palette. This will suggest colour combinations which can be seen by users with colourblindness, and which also suit the type of data you are showing (ordinal, for example) (more background on founder Cindy Brewer here).

It is a good idea to use a tool like Colorbrewer to help you choose the colour palette. This will suggest colour combinations which can be seen by users with colourblindness, and which also suit the type of data you are showing (ordinal, for example). Below you can see a good example (from this article) of how different colour schemes – and colour scales – communicate different types of data more clearly.

In that piece Christopher Ingraham writes: “Mapmakers often respect big distinctions by using a bivariate color scale – say, one set of colors for positive values (like blue), and another set of colors for negative ones (like red).” Colorbrewer includes explanations of different colour scales.

Consider making shapes semi-transparent so the detail underneath can still be seen; and setting border as white rather than black.

The information window

map info window

The Fusion Tables map info window allowed you to embed images from URLs in the data

Most mapping tools also allow you to customise the window which appears when a user clicks on a point or shape.

Often these default to a list of headings and values. The headings are taken from your original spreadsheet, and the values from the particular row (location) being shown.

For that reason it’s a good idea to make sure headings are clear, and to choose only the data that needs to be in that box.

But in the more advanced tools it’s also worth taking the time to customise information windows further so that they are not merely a list of values, but rather a more readable sentence.

For example, instead of Location: Amsterdam, population: 3,000,000, burglaries per 1000: 0.5 you would customise the code to read:

In Amsterdam there are 0.5 burglaries for every thousand people. The city has a population of 3,000,000 people

Of course that requires reading up on that.

Mapping routes

Routes are mapped much less often than shapes or points, but it is worth mentioning them here too.

Tools like Meograph, Dipity and Tripline allow you to tell stories with routes, while Google Maps Engine Lite allows you to draw them and export in a format which can be used in mapping tools.

If your story is about a route it is worth considering these tools instead of simple points. You could also look at timeline tools like Timeline JS (and Dipity again) as routes can often be shown in this format too.

A route has its own built-in narrative which can be quite powerful. They lend themselves to photoblogging (taking images along the route) or audio or video (likewise). You could present data about each point along the route using those media (charts, for example) rather than making it about the map.

Image maps

A final type of map is not, strictly speaking, geographical at all. This is the image map.

An image map is created when an image is ‘mapped’ by overlaying interactive elements on top of it. A good example might be an image of a group of people: this could be made into an image map by bringing up information about a particular person when your mouse hovers over her, or when you click on him.

Indeed, on Facebook when you tag a person in an image this is exactly what happens. And Flickr allows you to add information to images in a similar way.

Image maps can be created with any image: it could be a picture of a complex system; a diagram; a street scene; a floor plan or schematic. In short, any image which includes elements you can tell different stories about.

Image maps are one alternative way to create interactive maps without having to use shape files: simply find a map of the regions you wish to visualise, and add a layer of interactivity on top.

The tool Thinglink is one of the easiest ways to create an image map: you upload your image, then select an area you want to make interactive, then type the text, or image, video or audio URL, that you want to appear or play when someone clicks on that part of the image.

But you can achieve the same effect and take more control with JavaScript too.

Where next? The tools

I’ve mentioned a lot of tools above. Which ones you use depends on what you want to achieve, but also how quickly and easily you want to do that.

  • Datawrapper offers both points-based (symbol) maps and shape (choropleth) maps, as well as ‘locator’ maps (showing the location of an event). It has a number of administrative area shapes built in, for a range of countries.
  • Flourish also offers those as well as route (‘arc’ and ‘connections’) maps, 3D and ‘projection’ options, and time-lapse maps too.
  • BatchGeo is very quick and easy to get started with when it comes to mapping points. However, if you have more than a hundred views (or too many rows) then BatchGeo will ask you to pay to upgrade to the Pro version.
  • Tableau has some mapping options which are also worth exploring – particularly if you want to size placemarkers. It can also be combined with Mapbox, another mapping tool.
  • CartoDB is another mapping tool which offers different functionality – for example the ability to size points based on a particular value. It also allows you to query your data and create different views using a language called SQL. However, it is no longer accepting new accounts so check if your organisation has an account.
  • OpenHeatMap is a quick way to get started on mapping shapes – but make sure you read the documentation carefully and download the example spreadsheets for the shapes you want to use. You need to give your location column the same name as the documentation specifies, and make sure that location names match exactly (watch out for ampersands).
  • Fusion Tables can do both points and shapes (and routes) and provides more customisation. [Fusion Tables was closed in 2019]

I could list dozens more, but if you have a problem which these don’t address then try searching for mapping tools or libraries that do.

2 thoughts on “When to use shape maps in data visualisation: part 2 of a great big guide

  1. Pingback: Longform para el weekend. Lecturas sobre periodismo para el fin de semana

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.