GeomSmooth

Smooth geometry: a fitted trend line (with an optional confidence ribbon) over an x/y scatter, one fit per group. Use to reveal trends.

Defaults

geom
smooth
default stat
smooth
default position
identity
params type
SmoothParams

Svelte component

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

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

JSON layer

{
  "geom": "smooth",
  "stat": "smooth"
}

Params

method

"lm" | "loess"

Smoothing method: "lm" (least-squares line) or "loess" (local polynomial regression). Omit to infer: loess for fewer than 1000 rows, lm above (an advisory reports the choice).

se

boolean

Draw the confidence-interval ribbon around the fit. Default true.

level

number

Confidence level of the ribbon, strictly between 0 and 1. Default 0.95.

span

number

LOESS ONLY: fraction of points in each local neighborhood, greater than 0 and at most 1. Default 0.75. Smaller = wigglier.

degree

1 | 2

LOESS ONLY: degree of the local polynomial, 1 or 2. Default 2 (the R default).

n

number

Number of evaluation points along x (an integer between 2 and 5000). Default 80.

linewidth

number

Stroke width of the fitted line in px. Must be greater than 0. Default 1.

alpha

number

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

strokePaint

GradientPaint

Within-mark gradient stroke paint for the fitted line (not a data scale).

glow

GlowSpec

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

Allowed stats

Allowed positions

Examples

← All geoms · Getting started