How to make a gradient colour map using Carto

Gradient maps are great ways to simplify complex and ‘busy’ visual data. Here's how you can make your own on Carto.

Gradient maps such as the one below – showing the levels of crime in the various wards of Hackney – are a great way to simplify complex and ‘busy’ visual data. For the reader it’s far easier to interpret this form of colour schematic than having to count tiny dots or constantly referring to a table of numbers. 

The map below was made using the online mapping tool Carto, a data set from the Metropolitan Police and a file of the ward boundaries, published by Hackney Council. My goal in this article is to show you how to assemble these elements.

First it’s important that you are clear exactly what data you want to map out. This can either be the easy bit, or the hard bit, especially if you are stuck for an idea! For this example I wanted to map the crimes in Hackney for one month, July 2017.  

We need to ensure that the data is uniform and in order i.e. clean our data and extract only the data for the Hackney Borough. To do this we will need to filter the data using Excel’s or Google Sheet’s filter function.

With our data now filtered, lets copy it to a new spreadsheet and save it as a .csv file – we will need this later on.

Next we will input or ward boundary data into Carto. Data for borough and ward data can often be found on council websites and if your having difficulty tracking down the data you need there are several cartography forums and databases that may have what you’re looking for. 

With mapping file at the ready, logon to Carto – or create a new account if you’re new to the site – and upload your file to the ‘datasets’ area of your Carto account. At this stage also upload your .csv file that you saved earlier to the same area.  

Now create a new map and select both the datasets we have just uploaded. First off, we can hide the crime plots, the red circles, as we don’t need them to be visible right now.

You’ll then want to click on the wards map, and select a new analysis. We want to use the intersect second layer function, as this will count all the points from the crime data within the boundaries the ward map sets, and thus give us a value for crime in each ward.

Now we will need to tell Carto what we want to intersect. In this case we only have one other data set on the map, so it is as simple as clicking the ‘select target box’ and selecting our other data.



Now we need to tell Carto what to do with that analysis, and how to display it. We will go to ‘style’ and select ‘Colour Gradient’ and ‘Count Vals’. This is telling Carto to assign a colour to each ward based on the count of values within the borders. 


You can then set a custom colour gradient of your choosing – in this case I just chose the default setting of yellow to red.



And that’s it – you have visualised your data set! You can now publish your map, or embed it on your own website. Make sure to keep up to date with Interhacktives to read more Carto and other data visualisation guides.

Leave a Reply