1  tmap version 4

1.1 Intro

Let’s start by installing tmap version 4:

remotes::install_github("r-tmap/tmap@v4")

Then attach some packages…

library(sf)
library(terra)
library(spData)
library(tmap)

… and create our first map (Figure 1.1)!

tm_shape(nz) +
  tm_borders()

Figure 1.1: My first map

1.2 My second map

As mentioned in Section 1.1, we are going to make some maps!

tm_shape(nz) +
  tm_polygons(fill = "Median_income", 
              fill.scale = tm_scale_continuous(values = "viridis"),
              fill.legend = tm_legend(title = "Median income\n(USD, 2007)")) +
  tm_graticules() +
  tm_compass(position = tm_pos_in("left", "top")) +
  tm_scalebar() +
  tm_title("Wowwowowwow") +
  tm_credits("OGH2023")

Table 1.1: Comparision between tmap v3 and v4
Version Description
3 Good
4 Better

This will be a reference to Knuth (1984).