geom-spoke

Spoke layer: one segment from (x, y) along (angle, radius) per row.

angle is a Typst angle (e.g., 45deg) when supplied as a layer parameter; mapped values are read as numbers in radians from the data. radius is the segment length in data units.

Usage

geom-spoke(
  mapping: none,
  data: none,
  angle: 0deg,
  radius: 1,
  stroke: 0.8pt,
  colour: auto,
  alpha: auto,
  linetype: "solid",
  stat: "identity",
  position: "identity",
  inherit-aes: true,
)

Parameters

Parameter Default Description
mapping none Layer-specific aesthetic mapping built with aes. Must map x, y. angle and radius may be mapped or left to the layer-level fallbacks.
data none Layer-specific dataset. Falls back to the plot data when none.
angle 0deg Layer-level direction (a Typst angle, e.g., 45deg) used when aes(angle: ...) is not mapped.
radius 1 Layer-level length in data units used when aes(radius: ...) is not mapped.
stroke 0.8pt Line thickness (a Typst length).
colour auto Fixed line colour. auto resolves via the colour scale.
alpha auto Line opacity in [0, 1].
linetype "solid" Dash keyword. Defaults to "solid".
stat "identity" Statistical transform name. Usually "identity".
position "identity" Position adjustment name. Usually "identity".
inherit-aes true Whether to merge the plot-level mapping into this layer’s mapping.

Returns

Layer dictionary consumed by plot.

Examples

Eight unit-length spokes radiating from the origin at evenly spaced angles.

#let d = range(0, 8).map(i => (
  x: 0, y: 0, angle: i * calc.pi / 4, r: 1,
))
#plot(
  data: d,
  mapping: aes(x: "x", y: "y", angle: "angle", radius: "r"),
  layers: (geom-spoke(stroke: 1pt),),
  width: 8cm,
  height: 8cm,
)

Eight unit-length line spokes radiating from the origin at evenly spaced angles of 45 degrees forming a star pattern.

Eight unit-length line spokes radiating from the origin at evenly spaced angles of 45 degrees forming a star pattern.

See also

geom-segment, geom-curve.

Back to top