The viz_graticule function draws a graticule (latitude and longitude lines)
on the map. The spacing between lines can be uniform or specified separately for parallels
and meridians.
Usage
viz_graticule(
map,
id = NULL,
step = 10,
stroke = "#9ad5e6",
fill = "none",
strokeWidth = 0.8,
strokeLinecap = "square",
strokeLinejoin = "round",
strokeDasharray = 2,
...
)Arguments
- map
A
geovizmap created withviz_create.- id
character. Optional. Unique layer id.
- step
numeric or vector. Optional. Gap between graticules (default 10). Can be a single value or a vector of two values (e.g.
c(10, 20)).- stroke
character. Optional. Stroke color (default "#9ad5e6").
- fill
character. Optional. Fill color (default "none").
- strokeWidth
numeric. Optional. Stroke width (default 0.8).
- strokeLinecap
character. Optional. Stroke line cap (default "square").
- strokeLinejoin
character. Optional. Stroke line join (default "round").
- strokeDasharray
numeric or vector. Optional. Stroke dash pattern (default 2).
- ...
Additional SVG attributes (e.g.
opacity, etc.).
Examples
library(sf)
world <- st_read(
system.file("gpkg/world.gpkg", package = "geoviz"),
quiet = TRUE
)
viz_create(projection = "EqualEarth", background = "white") |>
viz_path(datum = world, fill = "#f1f3f5") |>
viz_graticule(step = c(10, 20), stroke = "#38896F") |>
viz_render()