CoordTransform

Post-stat coordinate projection with independent x/y transforms (identity, log10, sqrt), semantic viewport limits, reverse, and panel clipping. Distinct from pre-stat scale transforms.

Svelte component

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

<GGPlot data={rows} aes={{ x: "x", y: "y" }}>
  <GeomPoint />
  <CoordTransform x="log10" y={{ transform: "sqrt" }} />
</GGPlot>

Declaration-only: emits no markup. Registers a live coord layer on init; inert without a <GGPlot> ancestor. Coords are REPLACE — the last registered coord wins.

JSON and helpers

import { coordTransform } from "@ggsvelte/spec";

coordTransform({ x: "log10", y: { transform: "sqrt", reverse: true }, clip: true })
// → { type: "transform", x: { transform: "log10" }, y: { transform: "sqrt", reverse: true } }
{
  "coord": {
    "type": "transform",
    "x": { "transform": "log10" },
    "y": { "transform": "sqrt", "reverse": true },
    "clip": true
  }
}

Helper: coordTransform (alias coord_transform) . Schema type: CoordTransformSpec. Portable type: "transform". Builder: .coordTransform(), .coord().

Props

Options map 1:1 to the portable coord object (excluding the type discriminant). On CoordTransform, x and y also accept a bare transform name string via the helper/shell sugar.

x

CoordTransformAxisSpec

Optional x-axis projector: transform, semantic limits, reverse, and expand. Accepts a transform name string or an axis options object on the helper/shell.

y

CoordTransformAxisSpec

Optional y-axis projector: transform, semantic limits, reverse, and expand. Accepts a transform name string or an axis options object on the helper/shell.

clip

boolean

Clip marks to the panel rectangle (default true). Set false only when intentional overflow should remain visible.

Axis options

Shared fields for x and y under type: "transform". Coordinate limits are a viewport in semantic units — they never drop rows or re-run statistics. Non-identity transforms require continuous, non-temporal position scales on that axis. coord_transform cannot compose with coord_flip in one PortableSpec yet.

transform required

"identity" | "log10" | "sqrt"

Post-stat coordinate transform for this axis: identity, base-10 logarithm, or square root.

limits

[number, number]

Optional coordinate viewport [min, max] in semantic/source units. Exactly two numbers. Unlike scale limits, coordinate limits do not remove rows or recompute statistics.

reverse

boolean

Reverse this coordinate axis after its transform without changing stat inputs or the trained semantic scale domain.

expand

boolean

Whether explicit coordinate limits receive the default 5% transformed-space display expansion (default true). Set false for exact viewport limits.

← All coords · Scales · Facets and coordinates