Skip to contents

The viz_rhumbs function draws rhumb lines (loxodromes), similar to those found on old portolan charts. These lines represent paths of constant bearing.

Usage

viz_rhumbs(
  map,
  id = NULL,
  nb = 16,
  pos = c(10, 10),
  coords = "svg",
  stroke = "#394a70",
  strokeWidth = 1,
  strokeOpacity = 0.3,
  strokeDasharray = c(3, 2),
  ...
)

Arguments

map

A geoviz map created with viz_create.

id

character. Optional. Unique layer id.

nb

numeric. Optional. Number of lines (default 16).

pos

numeric vector. Optional. Position of the lines (default c(10, 10)). If coords = "svg", values are in SVG coordinates. If coords = "geo", values are longitude and latitude.

coords

character. Optional. Coordinate system for pos (default "svg"). If coords = "geo" and the map is zoomable, lines follow zoom interactions.

stroke

character. Optional. Stroke color (default "#394a70").

strokeWidth

numeric. Optional. Stroke width (default 1).

strokeOpacity

numeric. Optional. Stroke opacity (default 0.3).

strokeDasharray

numeric or vector. Optional. Stroke dash pattern (default c(3, 2)).

...

Additional SVG attributes (e.g. opacity, strokeLinecap, 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_rhumbs(
  nb = 32, coords = "geo", pos = c(0, 0),
  fill = "#38896F"
) |>
viz_render()