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> 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
}
} 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.
xCoordTransformAxisSpecOptional x-axis projector: transform, semantic limits, reverse, and expand. Accepts a transform name string or an axis options object on the helper/shell.
yCoordTransformAxisSpecOptional y-axis projector: transform, semantic limits, reverse, and expand. Accepts a transform name string or an axis options object on the helper/shell.
clipbooleanClip 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.
transformrequired"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.
reversebooleanReverse this coordinate axis after its transform without changing stat inputs or the trained semantic scale domain.
expandbooleanWhether explicit coordinate limits receive the default 5% transformed-space display expansion (default true). Set false for exact viewport limits.
Related
- Facets and coordinates
- Scales and guides — pre-stat scale transforms