GeomFunction
Function geometry: evaluate a named portable function y = f(x) on a grid and draw a path. Requires params.fun; domain from params.xlim, mapped x, or peer layers.
Defaults
- geom
function- default stat
function- default position
identity- params type
FunctionParams
Svelte component
import { GGPlot, GeomFunction } from "@ggsvelte/svelte";
<GGPlot data={rows} aes={{ x: "x", y: "y" }}>
<GeomFunction
fun={/* … */}
/>
</GGPlot> JSON layer
{
"geom": "function",
"stat": "function",
"params": { "fun": /* … */ }
} Params
funrequiredFunctionRegistryNameRequired named function from the portable registry.
nnumberNumber of evaluation grid points (2–10000). Default 101.
xlimArray<number>Evaluation domain [min, max] (min < max). When omitted, uses continuous aes.x extent or peer-layer x domain.
argsFunctionArgsOptional named arguments for the registry function (e.g. mean and sd for dnorm). Keys and values must be portable JSON.
alphanumberPath opacity. Must be between 0 and 1 (inclusive). Default 1.
linewidthnumberStroke width in px. Must be greater than 0. Default 1.5.
strokePaintGradientPaintWithin-mark gradient stroke paint (not a data scale). Requires a solid fallback.
glowGlowSpecBounded within-mark glow treatment (not theme decoration).
Allowed stats
functiondefault
Allowed positions
identitydefault