Skip to main content

Section 3.4 Classification systems for thematic maps

In thematic mapping, you have to make some key decisions, the most important one being how to display your data. When mapping a quantitative variable, we often have to "bin" this variable into groups. For example in the map we made below, the default binning applied was to display LSOAs grouped into those with a number of 0 to 10,000 crimes per 100,000 residents, then from 10,000 to 20,000, and so on. But why these? How were these groupings decided upon?
The quantitative information is usually classified before its symbolization in a thematic map. Theoretically, accurate classes that best reflect the distributional character of the data set can be calculated. There are different ways of breaking down your data into classes. We will discuss each in turn here.
The equal interval (or equal step) classification method divides the range of attribute values into equally sized classes. What this means is that the values are divided into equal groups. Equal interval data classification subtracts the maximum value from minimum value in your plotted variable and then divides this by the number of classes to get the size of the intervals. This approach is best for continuous data. The range of the classes is structured so that it covers the same number of values in the plotted variable. With highly skewed variables, this plotting method will focus our attention in areas with extreme values. When mapping crime, it will create the impression that everywhere is safe, save a few locations. The graphic below shows five classes and the function shows the locations (represented by points) that fall within each class.
library(classInt) # Package that introduces the classification methods
pal1 <- c("wheat1", "red3")
plot(classIntervals(manchester$crimr1,
                    n=5,
                    style="equal"),
     pal = pal1,
     main="Equal Intervals")
A line graph titled ’Equal Intervals’. The vertical axis is labeled ’fn of x’, and ranges from zero point zero to one point zero. The horizontal axis is labeled ’x’, and ranges from zero to sixty thousand. The five colours from our previous figures shade parts of the axis they correspond to, from yellow to red. The points of the line graph start at the zeros, and steeply climb to around zero point nine in the first few thousand values of x, then slightly slow their climb and reach almost one point zero before x is ten thousand. All of this is contained within the first colour class shading the horizontal axis. Only a few further points lie outside this colour.
Figure 3.4.1. Results for equal intervals classification
The quantile map bins the same count of features (areas) into each of its classes. This classification method places equal numbers of observations into each class. So, if you have five classes you will have twenty percent of the areas within each class. This method is best for data that is evenly distributed across its range. Here, given that our variable is highly skewed, notice how the top class includes areas with fairly different levels of crime, even if it does a better job at separating areas at the lower end of the crime rate continuum. Several authors consider that quantile maps are inappropriate to represent the skewed distributions of crime ([Harries, 1999]).
pal1 <- c("wheat1", "red3")
plot(classIntervals(manchester$crimr1, n=5, style="quantile"), pal = pal1,
     main="Quantiles")
The previous line graph is now titled ’Quantiles’, and has had the colours along the horizontal axis squished, except for the last deep red. The colour changes all happen in the steep climb of the graph, within the first few thousand values of x.
Figure 3.4.2. Results for quantiles classification
The natural breaks (or Jenks) classification method utilizes an algorithm to group values in classes that are separated by distinct break points. It is an optimisation method which takes an iterative approach to its groupings to achieve least variation within each class. Cartographers recommend to use this method with data that is unevenly distributed but not skewed toward either end of the distribution.
pal1 <- c("wheat1", "red3")
plot(classIntervals(manchester$crimr1, n=5, style="jenks"), pal = pal1,
     main="Jenks")
This time the previous line graph is titled ’Jenks’, and seems to be a compromise between the previous two figures. The steep climb is divided into two colours, and the following gradual climb gets one colour as well. The plateau with just a few points gets two colours.
Figure 3.4.3. Results for Jenks classification
The standard deviation map uses the standard deviation (standardised measure of observations’ deviation from the mean) to bin the observations into classes. This classification method forms each class by adding and subtracting the standard deviation from the mean of the dataset. It is best suited to be used with data that conforms to a normal distribution.
pal1 <- c("wheat1", "red3")
plot(classIntervals(manchester$crimr1, style="sd"), pal = pal1,
     main="Standard Deviation")
The same line graph is now titled ’Standard Deviation’, and has gained more colours, fourteen total, for its gradient. Each one is the same size, and includes about four thousand values of x.
Figure 3.4.4. Results for standard deviation classification
The headtails method This uses a method proposed by [Jiang (2013)] as a solution for variables with a heavy tail distribution, like we often have with crime. "This new classification scheme partitions all of the data values around the mean into two parts and continues the process iteratively for the values (above the mean) in the head until the head part values are no longer heavy-tailed distributed. Thus, the number of classes and the class intervals are both naturally determined" ([Jiang, 2013], p. 482).
pal1 <- c("wheat1", "red3")
plot(classIntervals(manchester$crimr1, style="headtails"), pal = pal1,
     main="Headtails")
The same line graph yet again, with the title ’Headtails’. The five colours are distributed in a similar way to the Jenks classification, with the colour changes all slightly shifted by various amounts to the right.
Figure 3.4.5. Results for headtails classification
Not only do you need to choose the classification method, you also need to decide on the number of classes. This is critical. The convention in cartography is to choose between 5 to 7 classes, although some authors would say 5 to 6 ([Field, 2018]). Less than five and you lose detail, more than 6 or 7 and the audience looking at your map starts to have problems to perceive the differences in the symbology and to understand the spatial pattern displayed.
If you want to lie with a map, it would be very easy by using a data classification scheme that conveys the message that you want to get across. It is, thus, important that your decisions are based on good practice and are impartial.
For comparing the effects of using different methods, we can use small multiples. Small multiples is simply a way of reproducing side by sides similar maps for comparative purposes. To be more precise, small multiples are sets of charts of the same type, with the same scale, presented together at a small size and with minimal detail, usually in a grid of some kind. The term was popularized by Edward Tufte, appearing first in his Visual Display of Quantitative Information in 1983 ([Tufte, 1983]).
There are different ways of creating small multiples with tmap as you could see in the vignettes for the package, some of which are quicker but a bit more restricted. Here we are going to use tmap_arrange(). With tmap_arrange() first we need to create the maps we want and then we arrange them together.
Let’s make five maps, each one using a different classification method: Equal Interval, Quantile, Natural Breaks (Jenks), Standard Deviation, and Headtails. For each map, instead of visualising them one-by-one, just assign them to a new object. Let’s call them map1, map2, map3, map4, map5. So let’s make map1. This will create a thematic map using equal intervals.
map1 <- tm_shape(manchester) +
  #Use tm_fill to specify variable, classification method,
  # and give the map a title
  tm_fill("crimr1", style="equal", title = "Equal") +
  tm_layout(legend.position = c("left", "top"),
            legend.title.size = 0.7, legend.text.size = 0.5)
Now create map2, with the jenks method often preferred by geographers.
map2 <- tm_shape(manchester) +
  tm_fill("crimr1", style="jenks", title = "Jenks") +
  tm_layout(legend.position = c("left", "top"),
            legend.title.size = 0.7, legend.text.size = 0.5)
Now create map3, with the quantile method often preferred by epidemiologists.
map3 <- tm_shape(manchester) +
  tm_fill("crimr1", style="quantile", title = "Quantile") +
  tm_layout(legend.position = c("left", "top"),
            legend.title.size = 0.7, legend.text.size = 0.5)
Let’s make map4, standard deviation map, which maps the values of our variable to distance to the mean value.
map4 <- tm_shape(manchester) +
  tm_fill("crimr1", style="sd", title = "Standard Deviation") +
  tm_layout(legend.position = c("left", "top"),
            legend.title.size = 0.7, legend.text.size = 0.5)
And finally let’s make map5, which is handy with skewed distributions.
map5 <- tm_shape(manchester) +
  tm_fill("crimr1", style="headtails", title = "Headtails") +
  tm_layout(legend.position = c("left", "top"),
            legend.title.size = 0.7, legend.text.size = 0.5)
Notice that we are not plotting the maps, we are storing them into R objects (map1 to map5). This way they are saved, and you can call them later, which is what we need in order to plot them together using the tmap_arrange() function. So if you wanted to map just map3 for example, all you need to do, is call the map3 object. Like so:
map3
A shaded map of the LSOAs in Manchester, similar to the ones before, using the colourblind friendly blue gradient. The legend in the top left, titled ’Quantile’, lists which values correspond to the five colours, according to the Quantile classification; the first four colours correspond to a few values, and the last one to most. Much of the north half of Manchester is shaded in the darker colours. The south half has some dark LSOAs as well, but is generally lighter.
Figure 3.4.6. Quantile classification of crime in Manchester
But now we will plot all maps together, arranged using the tmap_arrange() function. Like so:
# deploy tmap_arrange to plot these maps together
tmap_arrange(map1, map2, map3, map4, map5)
Five different shaded maps of the LSOAs in Manchester are aligned in a grid. The first one, labeled ’Equal’, was the first map we constructed, and the third one, ’Quantile’, is the previous figure. The one labeled ’Standard Deviation’ looks very similar to the initial ’Equal’ map, with a hotspot in the centre, but now with two colours in the rest of Manchester. ’Jenks’ and ’Headtails’ are very similar, and both convey the same general concentrations of darker colours. In particular, colours lighten gradually moving away from the centre, with darker hotspots in the northeast and far south.
Figure 3.4.7. Compare maps using the different classifications of crime in Manchester
As we can see, using data-driven, natural breaks (as the Jenks or Headtails method do, in different ways) to classify data is useful when mapping data values that are not evenly distributed, since it places value clusters in the same class. The disadvantage of using this approach is that it is often difficult to make comparisons between maps (for example, of different crimes or for different time periods) since the classification scheme used is unique to each data set.
There are some other classification methods built into tmap which you can experiment with if you’d like. Your discrete gradient options are "cat", "fixed", "sd", "equal", "pretty", "quantile", "kmeans", "hclust", "bclust", "fisher", "jenks", "dpih", "headtails", and "log10_pretty". A numeric variable is processed as a categorical variable when using "cat", i.e., each unique value will correspond to a distinct category.
Taken from the help file, we can find more information about these, for example the "kmeans" style uses kmeans clustering technique (a form of unsupervised statistical learning) to generate the breaks. The "hclust" style uses hclust to generate the breaks using hierarchical clustering and the "bclust" style uses bclust to generate the breaks using bagged clustering. These approaches are outside the scope of what we cover, but just keep in mind that there are many different ways to classify your data, and you must think carefully about the choice you make, as it may affect your readers’ conclusions from your map.
Imagine you were a consultant working for one of the political parties in the city of Manchester. Which map would you choose to represent to the electorate the situation of crime in the city if you were the party in control of the local government? and which map would you choose if you were working for the opposition? As noted above, it is very easy to mislead with maps and, thus, this means the professional map maker has to abide by strict deontological criteria and take well-justified impartial decisions when visualising data.
[Cameron (2005)] suggests the following:
To know which classification scheme to use, an analyst needs to know how the data are distributed and the mapping objective. If the data are unevenly distributed, with large jumps in values or extreme outliers, and the analyst wants to emphasize clusters of observations that house similar values, use the natural breaks classification approach. If the data are evenly distributed and the analyst wants to emphasize the percentage of observations in a given classification category or group of categories, use the quantile classification approach. If the data are normally distributed and the analyst wants to represent the density of observations around the mean, use the equal interval approach. If the data are skewed and the analyst wants to identify extreme outliers or clusters of very high or low values, use the standard deviation classification approach.
No matter the choice you make, be sure to be explicit about why you made it, and the possible implications it has for your maps.