Skip to contents

Introduction

An inset map or minimap is a small map embedded in the main map. The purpose of such a small map is 1) to show geographic context (zoomed out) or 2) to show details (zoomed in). The first type is called a minimap, created via tm_minimap. The second type can be created with the general purpose function tm_inset(). So

  • we use tm_minimap(() to show a broader geographic context; where on earth is the main map located?
  • we use tm_inset() to zoom in on areas that are too cluttered at the main maps’s scale.

Note that both tm_inset() and tm_minimap() are map components (see vignette)

Minimaps

tmap_mode("plot")
#>  tmap modes "plot" - "view"
#>  toggle with `tmap::ttm()`
tm_shape(NLD_muni) +
    tm_polygons(
        fill = "edu_appl_sci") +
    tm_title("Population share with (applied) university degree in 2022") +
    tm_credits("Statistics Netherlands (CBS)") + 
    tm_minimap(position = c("left", "top"))
#> [tip] Consider a suitable map projection, e.g. by adding `+ tm_crs("auto")`.
#> Linking to GEOS 3.12.1, GDAL 3.8.4, PROJ 9.4.0; sf_use_s2() is FALSE
#> 
#> This message is displayed once per session.

The implementation in plot mode is experimental (and new as of tmap 4.2). It features a small globe. There are no options implemented yet to change the appearance. Note that it takes a few seconds to run due to the applied orthographic map projection.

The minimap is interactive in view mode.

tmap_mode("view")
#>  tmap modes "plot" - "view"
tmap_last()