GeomText

Text geometry: one label per data row at (x, y). No collision detection — labels draw exactly where placed. Requires x, y, and label channels.

Defaults

geom
text
default stat
identity
default position
identity
params type
TextParams

Svelte component

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

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

JSON layer

{
  "geom": "text"
}

Params

alpha

number

Text 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.

Allowed stats

Allowed positions

Examples

← All geoms · Getting started