Skip to contents

Draws any map from this package, or a map joined to your data, with sensible defaults: a projection suited to Mongolia, a colour-blind friendly palette, grey for missing values, optional labels and surroundings, and the data attribution as a caption. The result is a normal ggplot, so you can add layers, scales and themes to it.

Usage

mn_map(
  x = NULL,
  fill = NULL,
  trans = "identity",
  label = FALSE,
  context = FALSE,
  crs = NULL,
  lang = NULL,
  caption = TRUE,
  title = NULL,
  label_size = 2.6,
  limits = NULL,
  breaks = NULL,
  bins = NULL,
  midpoint = NULL,
  na_label = "No data"
)

Arguments

x

An sf object, typically from mn_aimags(), mn_soums(), mn_khoroos() or mn_join(), or a terra raster such as mn_elevation(), mn_landcover() or mn_population(). Defaults to the aimags.

fill

Column to colour the polygons by (unquoted), or a single colour such as "steelblue". Numbers get a continuous viridis scale; text and factors get a discrete one.

trans

Transformation of a numeric fill scale, such as "log10" or "sqrt". Useful when Ulaanbaatar dwarfs everything else.

label

TRUE to label each unit with its name (khoroos with their number), or an unquoted column to label with.

context

If TRUE, draws neighbouring countries, major rivers and lakes around the map.

crs

Projection. NULL picks one: Albers equal-area for the country or large parts of it, UTM zone 48N for Ulaanbaatar and other small areas in central Mongolia. See mn_crs().

lang

Language of labels when label = TRUE: "en", "mn" or "mns".

caption

TRUE adds the data attribution from mn_citation(); FALSE adds none; a string is used as is.

title

Optional plot title.

label_size

Text size of labels.

limits, breaks

Shared fill scale limits and legend breaks. Useful for comparing years or inset panels.

bins

For polygons, either a number of intervals or increasing numeric cut points. Values are binned before plotting; trans applies only to continuous scales.

midpoint

For continuous polygon values, use a diverging scale around this value (for example zero for differences).

na_label

Caption key for missing polygon values. NULL disables it.

Value

A ggplot object.

Examples

mn_map()

mn_map(mn_aimags(), fill = area_km2, label = TRUE)

mn_map(mn_khoroos(district = "Bayangol"), label = TRUE)


pop <- mn_example_population[mn_example_population$Year == 2025, ]
pop_map <- mn_join(pop, "Region", level = "aimag")
#> ℹ Joining at the aimag level; dropped 5 rows for larger units ("country" and
#>   "region") and 2196 rows for smaller units ("soum" and "bag").
mn_map(pop_map, fill = value, trans = "log10", title = "Population, 2025")

mn_map(mn_landcover())

mn_map(mn_elevation()) + ggplot2::geom_sf(data = mn_aimags(), fill = NA, colour = "white")