Getting Started

This webpage is a listing of the code utilised and the process of creating the maps and visualisations created for the journal article. All the visualisations use information drawn from the IRA nominal rolls series collated as part of the Military Service Pension Collection (MSPC).

All the spatial objects, lookup tables and shapefiles are included as part of a .RData package, this file along with the csv files are available here. However, the process of creating each of these spatial objects has been set out in detail below. The following code is designed to show a user how to reproduce the visualisations and analyses outlined in the journal.

The naming conventions for this analysis has been shortened largely for ease of use, while retaining the basic definition of what is being analysed, e.g. td_names = Townlands lookup table, townlands = td etc., etc.

This analysis requires that the user has some knowledge of how to utilise programming languages such as R, however, for new users the following guide is recommended, which will walk new users through the first stages of setting up R and RStudio, installing packages and setting up a workspace.

The majority of code used for this analysis follows the Tidyverse principals set out by Hadley Wickham.1 The map projections for this journal require the tmap package developed by Martijn Tennekes. Tennekes drew upon the earlier work of Hadley Wickham and Leland Wilkinson, to create what he referred to as the layered grammar of thematic maps.2 The sf (simple features) package authored by Edzer Pebesma is also used for all the spatial objects in this journal article.3 There are a number of tutorials written by Tennekes and others, however, the most relevant for this analysis is chapter 8 of the recent publication, Geocomputation with R by Robin Lovelace, Jakub Nowosad, Jannes Muenchow which uses the sf package in conjunction with tmap.4 This book is available online and written using R here.

The first task is to set a workspace on your computer and place the following csv files from this link into the workspace. Second task is the install the libraries listed below, the following command will do this automatically:

install.packages("tmap", "tmaptools", "tidyverse", "sf", "cartogram")

Before any visualisations can be created, a number of shapefiles that will be used in this analysis need to be downloaded. (Note: These are provided in the .RData file, however, for the purposes of reproducing the data analysis, the download links are provided for each of the shapefiles).

  • First is the townlands shapefile from the Ordnance Survey of Ireland (OSi), this is available to download here.

  • Second is of electoral divisions, this will be used for the divisional mapping. This is available from the OSi at the following link.

  • Third is an administrative county shapefile for Ireland, that shows the twenty-six counties, as opposed to modern local authorities. This is drawn from the GADM website and is available here.

  • Fourth is an administrative county shapefile for Northern Ireland, that shows the six counties, as opposed to modern local authorities. This is from the Ordnance Survey Northern Ireland available here.

  • Fifth is a topographical shapefile of Northern Europe from the VMap0 here - Note: This shapefile was adjusted in QGIS and Ireland was selected. This file was exported as Topography_Ireland with three distinct shapefiles: Lake, River and Elevation. It is available within the .RData package.

  • Sixth is a physiographical shapefile from the Geological Survey of Ireland. here.

Please note that the lookup tables were created using the specific OSi shapefiles above, there are revised versions available from the OSi, however, these include a number of substantial changes, in particular for the 2019 Townlands shapfile.

Note that all of these shapefiles have been used for strictly educational purposes, subject to the terms & conditions with which these files have been released to the general public.

Each lookup table utilised a match file that links townlands to their respective electoral divisions, this was used during the linking process of connecting IRA units to specific townlands and electoral divisions. The mapping schema outlines how each was linked and specifies the relevant archival file used. These files have been included for reference purposes.

Using the read.csv() command imports csv files in the R workspace and saves them as dataframes.

Load the libraries & Import lookup tables

library(tmap)
library(tmaptools)
library(sf)
library(cartogram)
library(tidyverse)
load('Data_Journal.RData')
read.csv('IRA_Lookup_1921-2_td.csv', 
         stringsAsFactors = F, 
         na.strings= c("NA", " ", "")) -> td_names

read.csv('unit_strengths.csv',
         stringsAsFactors = F,
         na.strings= c("NA", " ", "")) -> IRA_strengths

read.csv('limerick_towns.csv',         
         stringsAsFactors = F,
         na.strings= c("NA", " ", "")) -> limerick_towns

Import the shapefiles

This is how you import each of the shapefiles as simple features or sf objects.

# Start with the Townlands file
st_read('Townland_Boundaries_Generalised_20m__OSi_National_Statutory_Boundaries/Townland_Boundaries_Generalised_20m__OSi_National_Statutory_Boundaries.shp') -> td
## Reading layer `Townland_Boundaries_Generalised_20m__OSi_National_Statutory_Boundaries' from data source `/Users/jackkavanagh/Dropbox/R_Irish Geography/Townland_Boundaries_Generalised_20m__OSi_National_Statutory_Boundaries/Townland_Boundaries_Generalised_20m__OSi_National_Statutory_Boundaries.shp' 
##   using driver `ESRI Shapefile'
## Simple feature collection with 50109 features and 12 fields
## Geometry type: MULTIPOLYGON
## Dimension:     XY
## Bounding box:  xmin: -10.61854 ymin: 51.41991 xmax: -5.996385 ymax: 55.43514
## Geodetic CRS:  WGS 84
# Import the Electoral Division file
st_read('Electoral_Divisions__CSO_Generalised_20M/Electoral_Divisions__CSO_Generalised_20M.shp') -> ed
## Reading layer `Electoral_Divisions__CSO_Generalised_20M' from data source 
##   `/Users/jackkavanagh/Dropbox/R_Irish Geography/Electoral_Divisions__CSO_Generalised_20M/Electoral_Divisions__CSO_Generalised_20M.shp' 
##   using driver `ESRI Shapefile'
## Simple feature collection with 3409 features and 15 fields
## Geometry type: MULTIPOLYGON
## Dimension:     XY
## Bounding box:  xmin: -10.66265 ymin: 51.4199 xmax: -5.996385 ymax: 55.43514
## Geodetic CRS:  WGS 84
# Import the GADM Irish county file
st_read('gadm41_IRL_shp/gadm41_IRL_1.shp') -> cty_ire
## Reading layer `gadm41_IRL_1' from data source 
##   `/Users/jackkavanagh/Dropbox/R_Irish Geography/gadm41_IRL_shp/gadm41_IRL_1.shp' 
##   using driver `ESRI Shapefile'
## Simple feature collection with 26 features and 11 fields
## Geometry type: MULTIPOLYGON
## Dimension:     XY
## Bounding box:  xmin: -10.66284 ymin: 51.41991 xmax: -5.994504 ymax: 55.43514
## Geodetic CRS:  WGS 84
# Import the OSNI Northern Ireland county file
st_read('OSNI_Open_Data_-_50K_Boundaries_-_NI_Counties/OSNI_Open_Data_-_50K_Boundaries_-_NI_Counties.shp') -> cty_ni
## Reading layer `OSNI_Open_Data_-_50K_Boundaries_-_NI_Counties' from data source 
##   `/Users/jackkavanagh/Dropbox/R_Irish Geography/OSNI_Open_Data_-_50K_Boundaries_-_NI_Counties/OSNI_Open_Data_-_50K_Boundaries_-_NI_Counties.shp' 
##   using driver `ESRI Shapefile'
## Simple feature collection with 6 features and 2 fields
## Geometry type: MULTIPOLYGON
## Dimension:     XY
## Bounding box:  xmin: 188518.1 ymin: 309912.9 xmax: 366414.3 ymax: 453200.6
## Projected CRS: TM65 / Irish Grid
# Import the Topography - Elevation
st_read('Topography_Ireland/Elevation.shp') -> elevation_ire
## Reading layer `Elevation' from data source 
##   `/Users/jackkavanagh/Dropbox/R_Irish Geography/Topography_Ireland/Elevation.shp' 
##   using driver `ESRI Shapefile'
## Simple feature collection with 1356 features and 9 fields
## Geometry type: LINESTRING
## Dimension:     XY
## Bounding box:  xmin: -10.65053 ymin: 51.42464 xmax: -5.316916 ymax: 55.8615
## Geodetic CRS:  WGS 84
# Import the Topography - River
st_read('Topography_Ireland/River.shp') -> rivers_ire
## Reading layer `River' from data source 
##   `/Users/jackkavanagh/Dropbox/R_Irish Geography/Topography_Ireland/River.shp' 
##   using driver `ESRI Shapefile'
## Simple feature collection with 840 features and 12 fields
## Geometry type: LINESTRING
## Dimension:     XY
## Bounding box:  xmin: -10.25464 ymin: 51.54472 xmax: -5.626417 ymax: 55.39047
## Geodetic CRS:  WGS 84
# Import the Topography - Lake
st_read('Topography_Ireland/Lake.shp') -> lakes_ire
## Reading layer `Lake' from data source 
##   `/Users/jackkavanagh/Dropbox/R_Irish Geography/Topography_Ireland/Lake.shp' 
##   using driver `ESRI Shapefile'
## Simple feature collection with 366 features and 12 fields
## Geometry type: POLYGON
## Dimension:     XY
## Bounding box:  xmin: -10.18703 ymin: 51.71244 xmax: -5.612694 ymax: 55.60622
## Geodetic CRS:  WGS 84
# Import the Physiography file - Level 1 is adequate for this analysis
st_read('Physiographic_Units/SHAPEFILES/PHYSIOGRAPHY_IE_LEVEL_1.shp') -> physio_ire_1
## Reading layer `PHYSIOGRAPHY_IE_LEVEL_1' from data source 
##   `/Users/jackkavanagh/Dropbox/R_Irish Geography/Physiographic_Units/SHAPEFILES/PHYSIOGRAPHY_IE_LEVEL_1.shp' 
##   using driver `ESRI Shapefile'
## Simple feature collection with 905 features and 4 fields
## Geometry type: POLYGON
## Dimension:     XY
## Bounding box:  xmin: 417471.5 ymin: 519663.7 xmax: 734481.1 ymax: 965634.6
## Projected CRS: IRENET95 / Irish Transverse Mercator

Adjusting and Normalising the Shapefiles

For this analysis, all the Coordinate Reference Systems (CRS) were changed to the EPSG 29900 - TM65 / Irish National Grid. So we have a standardised CRS.

# Use the st_transform() command to change the CRS 
td %>% st_transform(29900) -> td
ed %>% st_transform(29900) -> ed
cty_ire %>% st_transform(29900) -> cty_ire
cty_ni %>% st_transform(29900) -> cty_ni
elevation_ire %>% st_transform(29900) -> elevation_ire
rivers_ire %>% st_transform(29900) -> rivers_ire
lakes_ire %>% st_transform(29900) -> lakes_ire
physio_ire_1 %>% st_transform(29900) -> physio_ire_1

This creates a spatial object from the list of town coordinates in county Limerick.

st_as_sf(limerick_towns, coords = c("Longitude", "Latitude"), crs=29900) -> limerick_towns_sf

The package “Tidyverse” contains the package “dplyr” which

# Filter the physiography class using the filter() command from dplyr() and save it as a new sf object
physio_ire_1 %>% filter(Physioclas == "Water") -> physio_ire_1_water

Next thing is to merge the two county shapefiles from Northern Ireland and the Republic of Ireland

# Select the name and geometry from Republic of Ireland counties
cty_ire %>% select(NAME_1, geometry) -> cty_ire

# Select the name and geometry from the Northern Ireland counties
cty_ni %>% select(CountyName, geometry) -> cty_ni

# Adjust the column names to match
colnames(cty_ire) <- c("name", "geometry")
colnames(cty_ni) <- c("name", "geometry")

# Use rbind() to join the two county shapefiles for an all-Ireland county file
rbind(cty_ire, cty_ni) -> cty_all_ire

The sf_use_s2() often causes issues with shapefiles, particularly sf objects that are created from joins.

# Turn off the sf_use_s2(), which is the s2 package based on the google s2geometry.io library
sf::sf_use_s2(FALSE)
## Spherical geometry (s2) switched off

The code for joining the the geographic lookup table to the townlands shapefile is as follows using the syntax of dplyr to join the dataframes to the shapefiles.

# This creates a linked townlands sf file with IRA lookup information
IRA_TD <- td %>% mutate(TD_ID=as.integer(as.character(TD_ID))) %>% 
                 select(TD_ID) %>% 
                 left_join(td_names, by="TD_ID")

Creating unit totals for Limerick Brigades

Using the IRA_strengths dataframe filter for battalions and brigades.

# Create specific data frames for each Brigade population table 
IRA_strengths %>% filter(BRIGADE == "WEST LIMERICK" & YEAR == "1921") -> wlim_strengths_21

IRA_strengths %>% filter(BRIGADE == "EAST LIMERICK" & YEAR == "1921") -> elim_strengths_21

IRA_strengths %>% filter(BRIGADE == "MID LIMERICK" & YEAR == "1921") -> mlim_strengths_21
# Create specific battalion totals 
wlim_strengths_21 %>% select(BATTALION, BATTALION_STRENGTH) %>% 
                      distinct(.keep_all = ) -> wlim_strengths_batts_21

elim_strengths_21 %>% select(BATTALION, BATTALION_STRENGTH) %>% 
                      distinct(.keep_all = ) -> elim_strengths_batts_21

mlim_strengths_21 %>% select(BATTALION, BATTALION_STRENGTH) %>% 
                      distinct(.keep_all = ) -> mlim_strengths_batts_21
# Create specific Brigade totals 
wlim_strengths_21 %>% select(BRIGADE, BRIGADE_STRENGTH) %>% 
                      distinct(.keep_all = ) -> wlim_strengths_brigs_21

elim_strengths_21 %>% select(BRIGADE, BRIGADE_STRENGTH) %>% 
                      distinct(.keep_all = ) -> elim_strengths_brigs_21

mlim_strengths_21 %>% select(BRIGADE, BRIGADE_STRENGTH) %>% 
                      distinct(.keep_all = ) -> mlim_strengths_brigs_21

Creating Limerick IRA brigades with unit totals

# Select 
IRA_TD %>% select(BRIGADE_21, BATTALION_21) %>% 
           filter(BRIGADE_21 == "WEST LIMERICK") %>% 
           group_by(BATTALION_21) %>% summarise() -> wlim_batts_21

IRA_TD %>% select(BRIGADE_21, BATTALION_21) %>% 
           filter(BRIGADE_21 == "EAST LIMERICK") %>% 
           group_by(BATTALION_21) %>% summarise() -> elim_batts_21

IRA_TD %>% select(BRIGADE_21, BATTALION_21) %>% 
           filter(BRIGADE_21 == "MID LIMERICK") %>% 
           group_by(BATTALION_21) %>% summarise() -> mlim_batts_21
# Select 
IRA_TD %>% select(BRIGADE_21) %>% 
           filter(BRIGADE_21 == "WEST LIMERICK") %>% 
           group_by(BRIGADE_21) %>% summarise() -> wlimerick_21

IRA_TD %>% select(BRIGADE_21) %>% 
           filter(BRIGADE_21 == "EAST LIMERICK") %>% 
           group_by(BRIGADE_21) %>% summarise() -> elimerick_21

IRA_TD %>% select(BRIGADE_21) %>% 
           filter(BRIGADE_21 == "MID LIMERICK") %>% 
           group_by(BRIGADE_21) %>% summarise() -> mlimerick_21
# Create new merged shapefiles with Battalion totals
wlim_batts_totals_21 <- merge(wlim_batts_21, 
                              wlim_strengths_batts_21, 
                              by.x="BATTALION_21", by.y="BATTALION")

elim_batts_totals_21 <- merge(elim_batts_21, 
                              elim_strengths_batts_21, 
                              by.x="BATTALION_21", by.y="BATTALION")

mlim_batts_totals_21 <- merge(mlim_batts_21, 
                              mlim_strengths_batts_21, 
                              by.x="BATTALION_21", by.y="BATTALION")
# Create new merged shapefiles with Brigade totals
wlim_brig_total_21 <- merge(wlimerick_21, 
                            wlim_strengths_brigs_21, 
                            by.x="BRIGADE_21", by.y="BRIGADE")

elim_brig_total_21 <- merge(elimerick_21, 
                            elim_strengths_brigs_21, 
                            by.x="BRIGADE_21", by.y="BRIGADE")

mlim_brig_total_21 <- merge(mlimerick_21, 
                            mlim_strengths_brigs_21, 
                            by.x="BRIGADE_21", by.y="BRIGADE")
# The sf objects can be merged very easily using rbind()
rbind(elim_brig_total_21, 
      wlim_brig_total_21, 
      mlim_brig_total_21) -> limerick_brigs_21
# Check that the merged brigades
limerick_brigs_21 %>% head(n=10)
## Simple feature collection with 3 features and 2 fields
## Geometry type: MULTIPOLYGON
## Dimension:     XY
## Bounding box:  xmin: 107442.4 ymin: 111768 xmax: 190003.1 ymax: 167386.5
## Projected CRS: TM65 / Irish Grid
##      BRIGADE_21 BRIGADE_STRENGTH                       geometry
## 1 EAST LIMERICK             2879 MULTIPOLYGON (((158393.8 12...
## 2 WEST LIMERICK             2511 MULTIPOLYGON (((114678.4 11...
## 3  MID LIMERICK             1862 MULTIPOLYGON (((148981.1 13...
# Create a specific bounding box for the maps of Limerick using the Limerick Brigade spatial objects
st_bbox(limerick_brigs_21) -> limerick_bbox

Creating Cartograms

This will create three different types of cartograms from the cartogram package created by Sebatian Jeworutzki.5

# First create contiguous cartograms
wlim_batts_totals_21 %>% cartogram_cont(weight = "BATTALION_STRENGTH") -> wlim_batts_21_carto
## Mean size error for iteration 1: 1.38434083891617
## Mean size error for iteration 2: 1.26479181374112
## Mean size error for iteration 3: 1.19196540005147
## Mean size error for iteration 4: 1.14179714980502
## Mean size error for iteration 5: 1.10526499523702
## Mean size error for iteration 6: 1.07833663794284
## Mean size error for iteration 7: 1.05836822867405
## Mean size error for iteration 8: 1.0435313657208
## Mean size error for iteration 9: 1.03250598454606
## Mean size error for iteration 10: 1.02431577645286
## Mean size error for iteration 11: 1.01823212167125
## Mean size error for iteration 12: 1.01371078526063
## Mean size error for iteration 13: 1.01034633540401
## Mean size error for iteration 14: 1.00783782180259
## Mean size error for iteration 15: 1.00603619204916
elim_batts_totals_21 %>% cartogram_cont(weight = "BATTALION_STRENGTH") -> elim_batts_21_carto
## Mean size error for iteration 1: 2.85845815308641
## Mean size error for iteration 2: 2.66169686189795
## Mean size error for iteration 3: 2.49879842367906
## Mean size error for iteration 4: 2.35419954716214
## Mean size error for iteration 5: 2.24338130706716
## Mean size error for iteration 6: 2.14750059605334
## Mean size error for iteration 7: 2.06040667405345
## Mean size error for iteration 8: 1.98167340355975
## Mean size error for iteration 9: 1.91069340053399
## Mean size error for iteration 10: 1.84674743071763
## Mean size error for iteration 11: 1.78913065540623
## Mean size error for iteration 12: 1.73723374361457
## Mean size error for iteration 13: 1.69053764336148
## Mean size error for iteration 14: 1.6485796327466
## Mean size error for iteration 15: 1.61090514729356
mlim_batts_totals_21 %>% cartogram_cont(weight = "BATTALION_STRENGTH") -> mlim_batts_21_carto
## Mean size error for iteration 1: 1.75640290752376
## Mean size error for iteration 2: 1.52121267497539
## Mean size error for iteration 3: 1.36421134159695
## Mean size error for iteration 4: 1.2579497580857
## Mean size error for iteration 5: 1.18510147111775
## Mean size error for iteration 6: 1.13443925989236
## Mean size error for iteration 7: 1.09870570933035
## Mean size error for iteration 8: 1.0731889399597
## Mean size error for iteration 9: 1.05476840790369
## Mean size error for iteration 10: 1.04134001667325
## Mean size error for iteration 11: 1.03166842934326
## Mean size error for iteration 12: 1.02575323701111
## Mean size error for iteration 13: 1.02104942075103
## Mean size error for iteration 14: 1.01727052932073
## Mean size error for iteration 15: 1.01421110325266
# Second create non-overlapping circles cartograms (Dorling method)
wlim_batts_totals_21 %>% cartogram_dorling(weight = "BATTALION_STRENGTH") -> wlim_batts_21_carto_dorling
elim_batts_totals_21 %>% cartogram_dorling(weight = "BATTALION_STRENGTH") -> elim_batts_21_carto_dorling
mlim_batts_totals_21 %>% cartogram_dorling(weight = "BATTALION_STRENGTH") -> mlim_batts_21_carto_dorling
# Third create non-contiguous cartograms
wlim_batts_totals_21 %>% cartogram_ncont(weight = "BATTALION_STRENGTH") -> wlim_batts_21_carto_ncont
elim_batts_totals_21 %>% cartogram_ncont(weight = "BATTALION_STRENGTH") -> elim_batts_21_carto_ncont
mlim_batts_totals_21 %>% cartogram_ncont(weight = "BATTALION_STRENGTH") -> mlim_batts_21_carto_ncont

Maps 1 - 4

Map 3 - Overview of the Limerick Brigades, IRA (11 July 1921)

# This is a black & white version of the Limerick Brigades
tm_shape(limerick_brigs_21) + 
tm_fill(col = "BRIGADE_STRENGTH", 
        palette = "viridis", 
        style = "fixed", breaks =c(1500, 1800, 2100, 2400, 2700, 3000)) +
tm_text("BRIGADE_21",
         col = "white", 
         size = 1,
         ymod = -0.9, 
         xmod = 0,
         fontfamily = "Rockwell", 
         just = "top") + 
tm_style("bw") + 
tm_legend(legend.title.size = 0.6,
          legend.text.size = 0.5,
          legend.position = c("LEFT", "TOP")) + 
tm_shape(limerick_towns_sf) + tm_dots(col = "black", size = 0.09) + 
tm_text("Town", 
         col = "white", 
         size = 0.8,
         ymod = -0.1, 
         xmod = 0,
         fontfamily = "Rockwell", 
         just = "top") +
tm_shape(cty_all_ire) + tm_borders()  +
tm_shape(physio_ire_1_water) + tm_fill(col = "#65737e") + 
tm_shape(elevation_ire) + tm_lines(col = "white", lwd = 0.5, alpha = 0.3) + 
tm_shape(rivers_ire) + tm_lines(col = "#65737e") + 
tm_layout(frame.lwd = 0.5,
          bg.color = "#c0c5ce") + 
tm_scale_bar(text.size = 0.4, 
             position = c("RIGHT", "BOTTOM")) +
tm_layout(inner.margins = c(0.04,0.04,0.04,0.04), 
          outer.margins=c(0,0,0,0))

Map 3 - Overview of the Limerick Brigades, IRA (11 July 1921) - Colour

# This is colour version of the Limerick Brigades
tm_shape(limerick_brigs_21) + 
tm_fill(col = "BRIGADE_STRENGTH", 
        palette = "viridis", 
        style = "fixed", breaks =c(1500, 1800, 2100, 2400, 2700, 3000)) +
tm_text("BRIGADE_21",
         col = "white", 
         size = 1,
         ymod = -0.9, 
         xmod = 0,
         fontfamily = "Rockwell", 
         just = "top") + 
tm_style("col_blind") + 
tm_legend(legend.title.size = 0.6,
          legend.text.size = 0.5,
          legend.position = c("LEFT", "TOP")) + 
tm_shape(limerick_towns_sf) + tm_dots(col = "black", size = 0.09) + 
tm_text("Town", 
         col = "white", 
         size = 0.8,
         ymod = -0.1, 
         xmod = 0,
         fontfamily = "Rockwell", 
         just = "top") +
tm_shape(cty_all_ire) + tm_borders()  +
tm_shape(physio_ire_1_water) + tm_fill(col = "#65737e") + 
tm_shape(elevation_ire) + tm_lines(col = "white", lwd = 0.5, alpha = 0.3) + 
tm_shape(rivers_ire) + tm_lines(col = "#65737e") + 
tm_layout(frame.lwd = 0.5,
          bg.color = "#c0c5ce") + 
tm_scale_bar(text.size = 0.4, 
             position = c("RIGHT", "BOTTOM")) +
tm_layout(inner.margins = c(0.04,0.04,0.04,0.04), 
          outer.margins=c(0,0,0,0))

Map 4 - Overview

tm_shape(elim_batts_totals_21, bbox = limerick_bbox) +  tm_fill(col = c("BATTALION_21", "BATTALION_STRENGTH"), 
                                                             title = c("Battalion Name", "No. of Men"),
                                                             style = "fixed", breaks = c(250, 350, 450, 550, 650)) + 
tm_shape(elim_brig_total_21) + tm_fill(col = "burlywood4", alpha = 0.3) + 
tm_style("col_blind") + 
tm_shape(cty_all_ire) + tm_borders() + 
tm_shape(limerick_towns_sf) + tm_dots(col = "black", size = 0.09) + 
tm_text("Town", 
         col = "black", 
         size = 0.5,
         ymod = -0.1, 
         xmod = 0,
         fontfamily = "Rockwell", 
         just = "top") +
tm_legend(legend.title.size = 0.6,
          legend.text.size = 0.5,
          legend.position = c("LEFT", "TOP")) + 
tm_layout(bg.color = "beige",
          panel.labels = c("Battalion Areas (East Limerick Brigade)", "Choropleth of Battalion Strengths (East Limerick Brigade)"),
          panel.label.size = 0.5,
          panel.label.fontfamily = "Rockwell") + 
tm_scale_bar(text.size = 0.25, 
             position = c("RIGHT", "BOTTOM"))

Map 5 - Comparative Cartograms of the East Limerick Brigade, IRA (11 July 1921)

Each cartogram was created and saved a tmap, these were then arranged using tmap_arrange()

# (a) Continuous Cartogram
tm_shape(elim_batts_21_carto) + tm_fill(col = "BATTALION_STRENGTH", 
                                        style = "fixed", breaks = c(250, 350, 450, 550, 650),
                                        legend.show = FALSE) + 
tm_style("col_blind") + 
tm_shape(cty_all_ire) + tm_borders() + 
tm_shape(limerick_towns_sf) + tm_dots(col = "black", size = 0.09) + 
tm_text("Town", 
          col = "black", 
          size = 0.5,
          ymod = -0.1, xmod = 0,
          fontfamily = "Rockwell", 
          just = "top") +
tm_layout(bg.color = "beige",
            panel.labels = "(a) Continuous Cartogram - Battalions within East Limerick Brigade",
            panel.label.size = 0.5,
            panel.label.fontfamily = "Rockwell",
            frame = FALSE) -> east_limerick_batts_1
# (b) Dorling Cartogram
tm_shape(elim_batts_21_carto_dorling) + tm_fill(col = "BATTALION_STRENGTH", 
                                                style = "fixed", breaks = c(250, 350, 450, 550, 650),
                                                legend.show = FALSE) + 
  tm_style("col_blind") + 
  tm_shape(cty_all_ire) + tm_borders() + 
  tm_shape(limerick_towns_sf) + tm_dots(col = "black", size = 0.09) + 
  tm_text("Town", 
          col = "black", 
          size = 0.5,
          ymod = -0.1, xmod = 0,
          fontfamily = "Rockwell", 
          just = "top") +
  tm_layout(bg.color = "beige",
            panel.labels = "(b) Dorling Area Cartogram - Battalions within East Limerick Brigade",
            panel.label.size = 0.5,
            panel.label.fontfamily = "Rockwell",
            frame = FALSE) -> east_limerick_batts_2
# (c) Non-Contiguous Cartogram
tm_shape(elim_batts_21_carto_ncont) + tm_fill(col = "BATTALION_STRENGTH", 
                                              style = "fixed", breaks = c(250, 350, 450, 550, 650),
                                              legend.show = FALSE) + 
  tm_style("col_blind") + 
  tm_shape(cty_all_ire) + tm_borders() +
  tm_shape(limerick_towns_sf) + tm_dots(col = "black", size = 0.09) + 
  tm_text("name", 
          col = "black", 
          size = 0.5,
          ymod = -0.1, xmod = 0,
          fontfamily = "Rockwell", 
          just = "top") +
  tm_legend(legend.title.size = 0.6,
            legend.text.size = 0.5,
            legend.position = c("LEFT", "TOP")) + 
  tm_layout(bg.color = "beige",
            panel.labels = "(c) Noncontiguous Cartogram - Battalions within East Limerick Brigade",
            panel.label.size = 0.5,
            panel.label.fontfamily = "Rockwell",
            frame = FALSE) -> east_limerick_batts_3
# This creates a legend only for the (a-c) Cartograms
tm_shape(elim_batts_21_carto_ncont) + tm_fill(col = "BATTALION_STRENGTH", title = "No. of Men",
                                              style = "fixed", breaks = c(250, 350, 450, 550, 650)) + 
  tm_style("col_blind") + 
  tm_legend(legend.title.size = 0.9,
            legend.text.size = 0.5,
            legend.position = c("center", "center")) + 
  tm_layout(legend.only = TRUE) -> east_limerick_batts_4

  1. Hadley Wickham, ‘Tidy Data’ in Journal of Statistical Software, vol. 59, no. 10 (April 2014).↩︎

  2. Martijn Tennekes, ‘tmap: Thematic Maps in R’ in Journal of Statistical Software, vol. 84, no. 6 (April 2018), p. 2.↩︎

  3. Edzer Pebesma, ‘Simple Features for R: Standardized support for spatial vector data’ in R Journal, vol. 10, no. 1 (July 2018).↩︎

  4. Robin Lovelace, Jakub Nowosad and Jannes Muenchow Geocomputation with R (2020) (https://geocompr.robinlovelace.net).↩︎

  5. Sebastian Jeworutzki, R package: ‘cartogram’ (https://cran.r-project.org/web/packages/cartogram/index.html).↩︎