On this page

CoordRadial

Polar/radial coordinates (ggplot2 coord_radial). Maps one aesthetic to angle and the other to radius for pie charts, coxcombs, and polar scatter. coord_polar is a helper alias with clip on.

Svelte component

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

<GGPlot data={rows} aes={{ x: "x", y: "y" }}>
  <GeomPoint />
  <CoordRadial />
</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 { coordRadial } from "@ggsvelte/spec";

coordRadial()
{
  "coord": { "type": "sf", "ratio": 1 }
}

Helper: coordRadial (alias coord_radial) · also coordPolar, coord_polar. Schema type: CoordRadialSpec. Portable type: "radial". Builder: .coordRadial(), .coordPolar(), .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.

theta

"x" | "y"

Which aesthetic maps to angle: "x" (default) or "y". The other aesthetic maps to radius. Pie charts use theta: "y".

start

number

Offset of the starting angle from 12 o'clock, in radians (default 0). Positive angles proceed clockwise when reverse does not flip theta.

end

number

Angle where the plot ends, in radians measured from 12 o'clock. Default is start + 2π (full circle). Use with start for partial polar plots.

innerRadius

number

Size of the inner radius hole as a fraction of the outer radius (0–1, default 0). Values above 0 produce a donut.

expand

boolean

When true (default), add a small expansion so data does not sit on the axes. When false, limits come directly from the scale (typical for pie/coxcomb).

clip

boolean

Clip marks to the panel. ggplot2 coord_radial defaults to clip off; coord_polar defaults to clip on. ggsvelte stores the effective boolean (default false for type "radial").

reverse

"none" | "theta" | "r" | "thetar"

Which directions to reverse: "none" (default), "theta", "r", or "thetar" (both). coord_polar(direction = -1) maps to reverse: "theta".

thetaLimits

[number, number]

Optional [min, max] limits for the theta (angle) aesthetic in semantic units. Exactly two numbers.

rLimits

[number, number]

Optional [min, max] limits for the radius aesthetic in semantic units. Exactly two numbers.

← All coords · Scales · Facets and coordinates