Skip to contents

In this vignette, we will demonstrate how to draw a map of Norway and surrounding countries with drawmap::draw().

Load data

Load map data

Firstly, we load the map data for Norway and surrounding European countries with load_maps_data().

norway <- load_maps_data(countries = "Norway")
europe <- load_maps_data()

Create a data frame with place names and coördinates

Secondly, we create a data frame with place names and their coördinates in WGS84 format. We will use this data frame to label the map with place names.1

places <- data.frame(
  Place = c(
    "Oslo",
    "Bergen",
    "Stavanger",
    "Trondheim",
    "Tromsø"
  ),
  Coordinates_WGS84 = c(
    "59.913333, 10.738889",
    "60.389444, 5.33",
    "58.97, 5.731389",
    "63.429722, 10.393333",
    "69.682778, 18.942778"
  )
)

coordinates <- load_coordinates(
  data = places,
  factor_cols = "Place",
  mutate_val = "Some of the major cities in Norway"
)

Draw map of Norway and surrounding countries

Next, we draw the map using drawmap::draw(). We specify the area data for Norway and the other European countries, as well as the colours for the areas and borders. Here, we use the sans font for the map. The resulting map is displayed below.2 In addition, we add labels for some of the major cities in Norway using the coordinates data frame.

p <- draw(
  area_data = norway,
  area_col = "#512888",
  area_fill = "#D4C2ED",
  other_areas_data = europe,
  other_areas_col = "#ADB0B8",
  other_areas_fill = "#D9DCE6",
  font = "sans",
  coordinates = coordinates,
  label_repel = TRUE
)

p
#> Scale on map varies by more than 10%, scale bar may be inaccurate

Map of Norway, with labels for some of the major cities, and surrounding countries.