Skip to contents

The viz_shadow function adds a shadow effect to map elements, typically used to enhance depth perception for shapes, symbols, or extruded visualizations. The layer is rendered in SVG and can be applied globally or to specific geometries.

Usage

viz_shadow(
  map,
  id = NULL,
  dx = 0,
  dy = 0,
  blur = 0,
  opacity = 1,
  fill = NULL,
  stroke = NULL,
  strokeWidth = NULL,
  coords = "geo",
  ...
)

Arguments

map

A geoviz map created with viz_create.

id

character. Optional. Unique layer id.

dx

numeric. Optional. Horizontal shadow offset (default 0).

dy

numeric. Optional. Vertical shadow offset (default 0).

blur

numeric. Optional. Blur intensity of the shadow (default 0).

opacity

numeric. Optional. Shadow opacity (default 1).

fill

character or function. Optional. Shadow fill color.

stroke

character or function. Optional. Shadow stroke color.

strokeWidth

numeric. Optional. Shadow stroke width.

coords

character. Optional. Coordinate system (default "geo"). Use "svg" if coordinates are already expressed in SVG space.

...

Additional parameters

Examples

library(sf)
world <- st_read(
  system.file("gpkg/world.gpkg", package = "geoviz"),
  quiet = TRUE
)
aus <- world[world$ISO3 == "AUS", ]

viz_create(margin = 5) |>
viz_shadow(id = "my_shadow_effect", stdDeviation = 2.5, dx = 5, dy = 5) |>
viz_path(datum = aus, fill = "#38896F", filter = "url(#my_shadow_effect)") |>
viz_render()