Skip to Main Content

Class-Specific Resources

Lines and Labels

In this tutorial, we’ll explore how to connect our different data points with lines in order to illustrate how journeys moved from Africa to ports in the Americas. We’ll also go over how to show labels for these ports. But first, let’s secure a new dataset from for this exercise.


STEP 1: Downloading a Dataset for Luanda from

For the purposes of this exercise, let’s narrow down the data we will visualize. Navigate to the Trans-Atlantic Slave Trade Database at and filter the results by Itinerary > Place of purchase > Principle place of slave purchase. Type “Luanda'' into the search field and check the box when it comes up in the results. You should see your results filtered down to a total of 3,624. (Note that this is the same filtering process we described in the Mapping Data from tutorial.)


Download that dataset by clicking Download > Excel > Filtered results with visible columns. Then modify the downloaded data (with columns for date, latitude, and longitude) so that it is ready to map as two separate CSV files, one called “sv-Luanda-embark” and “sv-Luanda-disembark.” Reference the tutorial Mapping Data from for a reminder of how this data needs to be modified and structured. Remember, you'll need to copy your data into two different sheet within your document, add the ports spreadsheet, and use VLOOKUP to add latitude and longitude data to each of the two sheets. Pay close attention to the instructions about VLOOKUP—you'll need to make sure change the column numbers from one sheet to the other as specified in the tutorial.


One thing is a little different here, though. For the embark sheet, you’ll notice that every embarking location is the same (Luanda). To make this simpler for QGIS, select all but the first row of data in that sheet and delete those rows. This will leave you with a single point for this layer, but that is all you need. Your sheet should look something like this:


Excel data sheet


Once you have your two CSV files ("sv-Luanda-embark” and “sv-Luanda-disembark”) ready to go, open QGIS and create a new project named “sv-Luanda.” Load the basemap file we've been using and then the two new Luanda CSV files.

STEP 2: Displaying Labels

Before we generate lines connecting our ports, let’s set labels to display on these ports. First, double click the "sv-Luanda-embark" layer and go to the Labels tab. Then,


  1. From the top drop down menu, select “Single labels”
  2. For the “Label with” selector, choose “Voyage itinerary imputed principal place of slave purchase (mjbyptimp)”
  3. Change font size to 22.

Singel Labels menu


  1. Hit Apply and OK. You should see the label appear for Luanda.
  2. Do the same for the disembark layer, but make the font size 16 instead. (Remember to select the appropriate “Label with” column.) Hit Apply and OK.

You probably won’t see the labels for all the disembark ports show up immediately (you may not see any labels at all). That’s because there are enough ports that QGIS has difficulty rendering all the labels when you are fully zoomed out. This creates the additional problem that even our Luanda label can’t be rendered. But we can fix this.

  1. Focus on an area of the disembark ports where there are just a few. Zoom in on those ports until the labels appear. You’ll probably have to zoom in quite a bit.
  2. When you finally see the labels, stop zooming. Go back to the Labels menu for the disembark layer and go to the Rendering menu.
  3. Check “Scale dependent visibility.”
  4. For the minus magnifier, click the button to the right that has an image of a mouse cursor. This will set the most zoomed out scale to display the labels to the scale you are currently at. This tells QGIS not to work at rendering the labels when you're too zoomed out and there are too many in the frame for it to handle.

Rendering tab in Singel Labels

  1. Click Apply and OK.

Now zoom out. When viewing the full map you should see the Luanda label. When you go to explore particular clusters of disembarking ports, when you zoom in enough those labels should appear.


Map with data points

STEP 3: Generating Lines between Points with MMQGIS’s Hub Lines

Now it’s time to connect our Luanda embarking hub to the various disembarking ports we have in the Americas. Given the large number of lines we have to draw, we’ll utilize a tool that is part of a QGIS plugin called MMQGIS. To install this plugin, in the top menu navigate to Plugins > Manage and Install Plugins… Type in “MMQGIS” and hit install. Now you’re ready to proceed.


  1. You should now see MMQGIS in your top menu, probably near the far right. Go to that option and select Create > Hub Lines / Distance.
  2. For Hub Layer, select the embark layer you’ve added. For Hub Name Field, select the field “Voyage itinerary imputed principal place of slave purchase (mjbyptimp).”
  3. For Spoke Layer, select the disembark layer, and for Hub Name in Spoke Layer select the same “Voyage itinerary imputed principal place of slave purchase (mjbyptimp)” field. (Tip: If Hub Name in Spoke Layer is grayed out, do step 5 first.)
  4. For Allocation Criteria select “Hub Name in Spoke Layer.”
  5. For Output File Name, name the file “sv-Luanda-lines,” select GeoJSON for the file type, and save the file to the same folder with the rest of your mapping files.
  6. Hit Apply and Close. You should see your new lines layer on your map.

Hub Lines on map

The lines show what regions of the Americas enslaved individuals who departed from Luanda were taken. But what is not immediately apparent is that most of these individual lines are in fact multiple lines laid on top of each other—because there were multiple journeys over this route. It would be nice to find a way to visualize which routes were heavier without clouding up the map too much. One simple way to do this is to modify the color and opacity of the lines. Making the color dark and then taking the opacity down to a very low percentage will make lines that have more overlap display darker than lines with less overlap. Here’s how to do that:


  1. Double click the "sv-Luanda-lines" layer and go to the Symbology tab.
  2. Change the Opacity to 5%.
  3. Click the color selector and make the color a darker red.
  4. Click Apply and OK.

The results won’t be dramatic, but they should be enough for you to quickly note the routes that were busier compared to the ones that were less busy. Zoom in to get a closer look where many routes bunch together.

Another thing we can do quickly that will help reveal where the routes were heaviest has to do with the display of the points.

  1. Double click the "sv-Luanda-disembark" layer and go to the Symbology tab.
  2. Where it says “Single symbol” select “Point cluster” instead. Hit Apply and OK.


Point Cluster on Map


Now for each disembarking port, you will see a number display. For our purpose, this is the number of times the data shows that a ship that embarked from Luanda arrived in this port. The higher the number, the darker the connecting line should be.


Finally, one last change we can make is to thickness of the lines themselves.


  1. Select the "sv-Luanda-lines" layer again and then the Symbology tab. In the top dropdown menu, select Graduated.
  2. For Value select "Slaves arrived at 1st port."
  3. Go down and hit Classify.
  4. Hit Apply and OK.

Now you should see lines appear thicker that represent a greater number of captives that were transported.