foss4g qgis qgis3 gis cartography bivariate-choropleth
I’ve had a fascination with bivariate choropleth maps for quite some time now. Who wouldn’t? With the right color combination, a bivariate choropleth map hits that sweet spot of being both visually stunning and highly informative. Just do a Google search of bivariate choropleth and you’ll see what I mean.
Inspired by this post by Joshua Stevens, this post will detail how to make bivariate choropleth maps in QGIS. We’ll create a bivariate choropleth map using election returns of the recent (2019) Philippine Elections focusing on 2 candidates – Senator Bato dela Rosa and Chel Diokno. The data (in GeoPackage format) can be found here.
Before diving into that, let’s go through some basics.
A choropleth map is a thematic map wherein areas (typically geographic areas) are colored, shaded, or patterned based on the value of a single variable (univariate) corresponding to that area. One of the most basic examples is a population density map. A choropleth map can be created in QGIS by using Graduated Symbology
on a polygon vector.
For example, let’s create a choropleth map by applying a Graduated Symbology
on our election returns dataset.
Graduated
.
Column
to DELA ROSA, BATO (PDPLBN) - PERCENTAGE
Classify
You’ve now created a choropleth map showing the percentage of votes obtained by the now Senator Bato dela Rosa for each of the provinces.
Here’s a simple rule to remember when creating choropleth maps: Use rates/percentages, not counts/totals.
Notice in the example above, we used percentage of votes for the province as the variable instead of total votes obtained. Using rates/percentages is important because if we used counts/totals, we’d introduce the bias brought by the fact that larger areas tend to have higher population. For example, a candidate can obtain more votes in Metro Manila than Tawi-tawi not because he is more popular in the former but simply because there are more voters in the Metro Manila than Tawi-tawi.
If choropleth maps are not normalized they become merely another population map.
A bivariate choropleth map is similar to a basic (univariate) choropleth map but instead of a single variable, it shows (surprise surprise) two variables at once
. A bivariate choropleth map doesn’t just show two variables at once but it also shows a relationship between these two variables
– do they agree or disagree, do they increase/decrease proportionally, etc..
Since a bivariate choropleth map shows two variables, the number of categories it has increases exponentially by two – a bivariate choropleth using two univariate choropleth with 3 categories each has 9 categories. Having too many categories in a single map isn’t good practice so a 3x3 or 4x4 bivariate choropleth is workable but anything above that is usually too much.
Also, the choice of colors is important since we’re basically combining/mixing the colors of the 2 univariate choropleths to create our bivariate choropleth. Joshua Stevens has a few bivariate color scheme examples that we can use, as seen below:
For example, our bivariate choropleth map below shows how the provinces voted during the 2019 Election in terms of voting for Bato and/or Chel. Are there areas where both of them got a lot of votes? Or does a high vote percentage for one candidate mean a lower vote percentage for the other? To answer these questions, we have 9 categories and using the second color scheme from Joshua Stevens above.
So how do we go about creating this map in QGIS?
If you can create a univariate choropleth map in QGIS, you can create a bivariate choropleth map. :)
The first step is to create two choropleth maps – one for each variable we want to show. In our case, these two variables are:
DELA ROSA, BATO (PDPLBN) - PERCENTAGE
- the percentage of total votes in the province obtained by BatoDIOKNO, CHEL (LP) - PERCENTAGE
- the percentage of total votes in the province obtained by ChelAfter loading the election returns data in QGIS, duplicate the layer so that you have 2 layers.
The top layer will be the choropleth map for Bato and the bottom layer will be the choropleth map for Chel. We can rename them to avoid confusion.
Now we edit each of the layer’s symbology using a Graduated Symbology with 3 categories
.
For Bato, we’ll use the left-most colors of our color scheme. Our parameters will be:
Symbology
- GraduatedColumn
- DELA ROSA, BATO (PDPLBN) - PERCENTAGEClasses
- 0.0 - 2.5
- Color: #e8e8e8
- Values: 0.000 - 2.5000
- 2.5 - 5.0
- Color: #dfb0d6
- Values: 2.500 - 5.000
- 5.0 - 100
- Color: #be64ac
- Values: 5.000 - 100.000
The result should be:
For Chel, we’ll use the bottom-most colors of our color scheme. Our parameters will be:
Symbology
- GraduatedColumn
- DIOKNO, CHEL (LP) - PERCENTAGEClasses
- 0.0 - 2.5
- Color: #e8e8e8
- Values: 0.000 - 2.5000
- 2.5 - 5.0
- Color: #ace4e4
- Values: 2.500 - 5.000
- 5.0 - 100
- Color: #5ac8c8
- Values: 5.000 - 100.000
The result should be:
Now here’s where we let QGIS do its magic to create our bivariate choropleth map. We edit the blending mode of the top layer to Multiply
. This parameter can be found in the Layer Styling Panel under Layer Rendering.
The result would now be a bivariate choropleth map. :)
We can now use this map in our Print Layout. But what about the legend?
Thankfully, QGIS has a plugin for creating bivariate legends (YAY PLUGINS!!!). The Bivariate Legend plugin can be installed via the Manage and Install Plugins Dialog.
This plugin generates a bivariate legend using two layers. The generated legend can then be exported to an image that can be added to the Print Layout.
Using the Bivariate Legend plugin, our parameters will be:
Top layer
- Election Returns - BATO
Check
Reverse ColorsBottom layer
- Election Returns - CHELSquare width
- 48Multiply
Click
Generate legendClick
Export legend to image
The bivariate choropleth map and the generated bivariate legend can now be used to create a map in the Print Layout like the one below. Good luck!
foss4g foss4gph qgis gis presentation
foss foss4g opensource freeasinfreedom freesoftware
foss4g foss4gph thesis uaap mapping the geography of the uaap spatial analytics basketball basketball analytics
foss4g foss4gph qgis gis presentation
If you find my website or any of the materials I share useful, you can consider donating to the cause below.
Except when explicitly stated otherwise, this work and its contents by Ben Hur S. Pintor is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Other works (software, source code, etc.) referenced in this website are under their own respective licenses.
This site is powered by Jekyll and hosted on Github (view source)