GeomFreqpoly

Frequency polygon: continuous x binned like a histogram, drawn as a line through bin centers. Do not map aes.y — the bin stat computes it. Canonicalized by normalize() to a line layer with stat bin.

Defaults

geom
freqpoly
default stat
bin
default position
identity
params type
LineParams

Alias

normalize() rewrites this geom to line (with this alias's default stat and position). Prefer the canonical geom in new code.

Svelte component

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

<GGPlot data={rows} aes={{ x: "x" }}>
  <GeomFreqpoly />
</GGPlot>

JSON layer

{
  "geom": "freqpoly",
  "stat": "bin"
}

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