Skip to main content

Class-Specific Resources

GIS Data Viz: Heatmaps and Change over Time

With data like that from SlaveVoyages.org, our maps can quickly become cluttered with overlapping symbols. The great span of time the data covers and the fact that the same ports hosted many voyages make visual representation a challenge. For that reason, we want to look beyond simple point symbols or even graduated point symbols to visualize the data. In this tutorial we’ll examine two complimentary ways of dealing with this challenge: heatmaps and a time animation.

Contents

STEP 1: Visualizing Points with a Heatmap

A heatmap uses a color ramp to illustrate the relative number of points in a given area. If the color ramp goes from light to dark, this means that the lighter the visualization becomes the more points are concentrated in that area and the darker the fewer points. We are most used to seeing heatmaps in our weather reporting apps with the color range referring to things like rainfall, storm intensity, or perhaps literally heat. In QGIS, the Symbology controls make generating a heatmap very simple.

 

For this tutorial, we will use the data you worked with from the previous map. Open QGIS, create a new project, and name it “sv-1750-1808-heatmap.” Add the same basemap we used before, then add the CSV file “sv-1750-1808-disembark.” We’ll use this to generate a heatmap that illustrates the numbers of enslaved individuals that arrived in the Americas through this period. Once you’ve added in your CSV layer and see it on the map, do the following:

 

  1. Double click your new layer in the Layer pane and select Symbology.
  2. In the top dropdown menu, select Heatmap.

Heatmap tab from drop down menu

  1. At the “Color ramp” selector, click the down arrow at the far right and select the Viridis color ramp. (If you'd like to learn more about the science behind different color ramps, this video is a good place to start.)

Viridis Color Ramp

  1. After you’ve selected the color ramp, click the color bar in the menu (the one that goes from purple to yellow). In this submenu, select “Color 1” and set its opacity to 0%. This will make the outermost layer of the heatmap (which by default extends over the entire map) invisible so that all you can see are the areas where there is actually data. Click OK and then OK again to exit the Select Color Ramp window.

Color opacity scale

  1. Finally, near the bottom of the menu, open Layer Rendering by clicking on the triangle and adjust the layer’s opacity to 80%. This will make the heatmap area slightly transparent so that the basemap will still be visible underneath. Click Apply and OK.

Layer rendering window

You should see a heatmap of your data now in place of individual points. 

Heatmap

As we’ve already noted, the colors correspond to lower or higher numbers of points, each of which corresponds to a row on our spreadsheet. In this case, since each row corresponds to a particular voyage, higher values mean a greater number of ships stopped at a given port within the given time frame.

  1. Double click the same layer in the Layer pane and once again select Symbology. You should see all of the Heatmap selections you just made.
  2. Go to the field “Weight points by” and select the column “Slaves arrived at 1st port.” Click Apply and OK.

Now the colors reflect both the number of stops and the overall number of enslaved individuals represented in those stops. You should see a difference, though it may be subtle.

Take a screenshot of your map, or export it as an image file to upload to Canvas.

STEP 2: Visualizing Change over Time with QGIS Plugin TimeManager

Another approach to visualizing change over time is a timeline. In terms of GIS, a timeline function filters your data according to a specified segment of time, for instance year by year. You can then drag a slider or simply hit play and see an animation of how your data changes from year to year. You can usually decide to see snapshots of the data as the timer progresses or see that data accumulate on your map.

 

To do this in QGIS, we need to install a plugin called TimeManager (a plugin is simply an added tool or feature to the program, made by an outside developer. Since QGIS is open sourced, many of its tools come in this form). To do this, simply go to Plugins > Manage and Install Plugins… in the top menu. Search for “TimeManger” and click Install. (If you get an error installing the plugin, you may need to run the following command in your terminal program: “pip3 install future.” Then uninstall and reinstall TimeManager. Please get in touch with the DSC if you are not sure what to do.)

Time manager window

Now let’s get TimeManager going.

  1. Go to Plugins > TimeManager > Toggle visibility. You should see the TimeManager window appear at the bottom of the screen.
  2. Click “Settings,” then “Add layer.”
  3. Select the layer you want to visualize. For “Start time” select the field in your data that holds the full date (YYYY-mm-dd). Leave “End time” set to “Same as start,” unless your data happens to have a separate end time. Note that near the bottom of the screen you can check the box to have data points accumulate as the time slider moves. Click OK.
  4. Note that near the bottom of the screen you can check the box next to “Accumulate features” to have data points accumulate as the time slider moves. For our purposes, we’ll leave it unchecked. Click OK and then OK again to exit the “Time manager settings window.”

Time manager settings window

  1. For “Time frame size” select “1 years.”
  2. Now make sure the on/off button (in the left top corner) is switched to on and hit play. You should see your data animate as the time slider moves. You can also pause the animation and drag the slider yourself to see specific years.

Heatmap

You can use TimeManager with any of the symbology options available. For instance, you can animate simple points, but you can also animate graduated symbols or, as we’ve done here, a heatmap. As you do so, consider what changes you see over time. How might we explain them?

 

Save your map, and be sure to take a screenshot to upload to Canvas.

A Final Note About Filtering Data

One final note about filtering when downloading data from SlaveVoyages.org. When you navigate to the database section of the site, you'll find a list of categories near the top of the page starting with "Year range," "Ship, nation, owner," and so on. You can set filters on each of these if you wish. We've gone over setting a year range filter in the previous tutorial.

If you want to add an additional filter that targets, for example, the principle place of purchase, you can do that by selecting "Itinerary" and then the "Place of purchase" tab. Then in the field "Principal place of slave purchase" input your search terms (e.g. "West Central Africa"). If there are results, you can check the box next to the categories you wish to include. When you've done that, click Apply at the bottom of the window. The results visible in the database should reflect what you've selected. You can verify what filters you currently have set in the light gray strip above the database results.

When you have what you want, you can download the filtered dataset by clicking Download > CSV [or Excel] > Filtered results with visible columns.