Using tmap for easier plotting

We can map quantitative and qualitative values in a much easier way using the tmap package. For a simple choropleth map, we can just use the qtm() function and inside it, there are two arguments. The first one is the shapefile and the second one is the numeric column we want to use for making a choropleth map. First, we need to install and load it before we proceed further:

# Using tmapinstall.packages("tmap")library(tmap)

We will be using BGD_adm3_data_re.shp and will use the value1 column for mapping. Let's load this dataset and check the structure of the attribute table associated with this shapefile:

# load the mapmap_bd = readOGR("F:/Hands-on-Geospatial-Analysis-Using-R-and-QGIS/Chapter02/Data","BGD_adm3_data_re") ...

Get Hands-On Geospatial Analysis with R and QGIS now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.