GeomLine

Line geometry: connects points in x order, one line per group (groups derive from discrete aesthetics such as color, or from aes.group). Use for time series, trends, and line charts. With stat ecdf, pair with step curves; with stat bin (freqpoly alias), y is computed from counts/density; with stat connect, successive points expand into connection vertices.

Defaults

geom
line
default stat
identity
default position
identity
params type
LineParams

Svelte component

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

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

JSON layer

{
  "geom": "line"
}

Params

alpha

number

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

linewidth

number

Stroke width in px. Must be greater than 0. Default 1.5.

curve

"linear" | "step" | "step-hv" | "step-vh"

Interpolation: "linear" (default), "step" (mid-x corners), "step-hv" (horizontal then vertical — correct for ECDF), or "step-vh".

pad

boolean

With stat ecdf: when true (default), prepend (xmin, 0) so step stairs start at zero. Finite-clamped.

n

number

With stat ecdf: evaluate on n equally spaced x in [min, max] per group; omit for one point per unique x.

connection

"hv" | "vh" | "mid" | "linear"

STAT CONNECT ONLY: how successive points join — "hv" (default), "vh", "mid", or "linear". Ignored for other stats.

bins

number

STAT BIN / SUMMARY_BIN: number of bins (integer ≥ 1). Default 30 — an advisory reminds you to pick a real value. Overridden by binwidth.

binwidth

number

STAT BIN / SUMMARY_BIN: bin width in data units (must be greater than 0). Takes precedence over bins.

boundary

number

STAT BIN / SUMMARY_BIN: align a bin EDGE with this x value. Mutually exclusive with center.

center

number

STAT BIN / SUMMARY_BIN: align a bin CENTER with this x value. Mutually exclusive with boundary.

closed

"right" | "left"

STAT BIN / SUMMARY_BIN: which edge of each bin is inclusive: "right" (default) or "left".

fun

"first" | "last" | "mean" | "median" | "min" | "max" | "sum"

SUMMARY_BIN center fun (mean/median/sum;) or MANUAL named transform (first|last|mean|median|min|max|sum;). Required when stat is "manual".

funMin

SummaryFun

STAT SUMMARY_BIN ONLY: lower bound summary (ymin).

funMax

SummaryFun

STAT SUMMARY_BIN ONLY: upper bound summary (ymax).

strokePaint

GradientPaint

Within-mark gradient stroke paint (not a data scale). Requires a solid fallback.

glow

GlowSpec

Bounded within-mark glow treatment (not theme decoration).

Allowed stats

Allowed positions

Examples

← All geoms · Getting started