Skip to contents

The goal of drawmap is to draw maps in R easily. The package provides a simple interface to draw maps with a uniform style, and is particularly useful for drawing maps with multiple layers, such as countries, regions, and points of interest. The package provides the following functions:

The package is built on top of the ggplot2 and sf packages. It accepts different types of spatial data, such as sf objects and data.frame objects with longitude and latitude columns.

Installation

You can install the development version of drawmap from GitHub with pak::pak() or remotes::install_github():

# Using `pak`:
# install.packages("pak")
pak::pak("EirikTengesdal/drawmap")
# Using `remotes`:
# install.packages("remotes")
remotes::install_github("EirikTengesdal/drawmap")

Example

library(drawmap)
norway <- load_maps_data(countries = "Norway")
europe <- load_maps_data()
p <- draw(
  area_data = norway,
  area_col = "#512888",
  area_fill = "#D4C2ED",
  other_areas_data = europe,
  other_areas_col = "#ADB0B8",
  other_areas_fill = "#D9DCE6",
  annotation_scale = FALSE
)

This yields a map like the one used in the drawmap package logo:

Map depicting Norway and the surrounding countries.

© 2024 Eirik Tengesdal

Licensed under the MIT License.

Author

Eirik Tengesdal
Assistant Professor of Norwegian
Department of Early Childhood Education (BLU)
OsloMet – Oslo Metropolitan University

Guest Researcher and PhD Student
Department of Linguistics and Scandinavian Studies (ILN)
University of Oslo

ORCID iD: 0000-0003-0599-8925