GeomSfLabel

Simple-features labels with background boxes: places aes.label at representative geometry points with a measured rounded rect (Multi* → one label per part). color=ink+box stroke; fill=box background.

Defaults

geom
sf_label
default stat
sf_coordinates
default position
identity
params type
SfLabelParams

Svelte component

import { GGPlot, GeomSfLabel } from "@ggsvelte/svelte";

<GGPlot data={rows} aes={{ x: "x", y: "y" }}>
  <GeomSfLabel />
</GGPlot>

JSON layer

{
  "geom": "sf_label",
  "stat": "sf_coordinates"
}

Params

geometry

string

Name of the data column holding GeoJSON Geometry JSON strings. Default "geometry".

alpha

number

Label opacity. Must be between 0 and 1 (inclusive). Default 1.

size

number

Font size in px. Must be greater than 0. Default 11.

anchor

"start" | "middle" | "end"

Horizontal text anchor relative to the representative point: "start", "middle" (default), or "end".

dx

number

Horizontal offset in px applied after positioning. Default 0.

dy

number

Vertical offset in px applied after positioning (positive = down). Default 0.

padding

number

Box padding around the text in px. Default 3.

radius

number

Box corner radius in px. Default 3.

linewidth

number

Box stroke width in px. Default 0.5.

Allowed stats

Allowed positions

Examples

← All geoms · Getting started