Skip to contents

Adds a GPU-rendered circle layer (points). Use formulas (e.g. ~mag * 2) to map columns to aesthetics.

Usage

add_circles(
  map,
  data = NULL,
  lon = NULL,
  lat = NULL,
  color = "darkblue",
  opacity = 1,
  width = 1,
  fill_color = "dodgerblue",
  fill_opacity = 0.8,
  radius = 6,
  stroke = TRUE,
  tooltip = NULL,
  popup = NULL,
  id = NULL,
  group = NULL,
  pickable = TRUE,
  radius_units = c("pixels", "meters", "common"),
  radius_min_pixels = NULL,
  radius_max_pixels = NULL,
  width_units = c("pixels", "meters", "common"),
  width_min_pixels = NULL,
  width_max_pixels = NULL
)

Arguments

map

A maplamina widget created by maplamina().

data

Data for this layer. If NULL, uses the default data supplied to maplamina().

lon, lat

Longitude/latitude aesthetics (formula or scalar). Required for non-sf data.

color, opacity, width

Stroke color/opacity/width.

fill_color, fill_opacity

Fill color/opacity. fill_color can be a single color, a vector of colors, or a color scale spec such as color_quantile().

radius

Circle radius (numeric or formula).

stroke

Logical; draw circle stroke.

tooltip, popup

Optional tmpl() objects (or NULL) for hover/click content.

id, group

Optional layer id and group name.

pickable

Logical; whether features can be picked (tooltip/popup).

radius_units

Units for radius; one of "pixels", "meters", or "common".

radius_min_pixels, radius_max_pixels

Optional clamp in pixels when using meter/common units.

width_units

Units for stroke width; one of "pixels", "meters", or "common".

width_min_pixels, width_max_pixels

Optional clamp in pixels when using meter/common units.

Value

The modified map widget.

Examples

d <- data.frame(
  lon   = runif(1000, -60, 60),
  lat   = runif(1000, -60, 60),
  value = runif(1000, 1, 10)
)
maplamina() |>
  add_circles(d, radius = ~value, fill_color = "dodgerblue")