plot_brmap: Plot a Brazilian map

View source: R/plot_brmap.R

plot_brmapR Documentation

Plot a Brazilian map

Description

Creates a 'ggplot' using [ggplot2::geom_sf()]. The returned object can be extended with any regular ggplot2 layer, scale or label.

Usage

plot_brmap(
  map,
  data = NULL,
  by = NULL,
  fill_by = NULL,
  theme = theme_brmap(),
  border_colour = "grey30",
  border_linewidth = 0.15,
  fill = "white",
  data_to_join = NULL,
  join_by = NULL,
  var = NULL
)

Arguments

map

An 'sf' or legacy 'Spatial' polygon object.

data

Optional data frame to join before plotting.

by

Join specification accepted by [dplyr::left_join()].

fill_by

Optional single column name mapped to polygon fill.

theme

A complete or partial ggplot2 theme.

border_colour

Polygon border colour.

border_linewidth

Polygon border width.

fill

Constant fill used when 'fill_by' is 'NULL'.

data_to_join, join_by, var

Deprecated aliases for 'data', 'by' and 'fill_by'.

Value

A 'ggplot' object.

See Also

[get_brmap()], [join_brmap()]

Examples

data("pop2017")
south <- get_brmap(
  "municipality", year = 2023, filters = list(region = 4)
)
plot_brmap(
  south,
  data = pop2017,
  by = c("municipality_code" = "mun"),
  fill_by = "pop2017"
)

brazilmaps documentation built on Aug. 4, 2026, 5:07 p.m.