GeomLabel

Label geometry: text with a rounded rectangular background box. Requires x, y, and label channels. No collision detection.

Defaults

geom
label
default stat
identity
default position
identity
params type
LabelParams

Svelte component

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

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

JSON layer

{
  "geom": "label"
}

Params

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 (x, y) position: "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

Uniform box padding around the text in px. Default 3.

radius

number

Corner radius of the background box in px. Default 3.

linewidth

number

Box outline stroke width in px. Default 0.5.

Allowed stats

Allowed positions

Examples

← All geoms · Getting started