geom-spoke

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

Since 0.4.0.

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: auto,
  colour: auto,
  alpha: auto,
  linetype: auto,
  stat: "identity",
  position: "identity",
  key: auto,
  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, or a function applied to the plot data returning the layer frame. 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 auto Line thickness (a Typst length).
colour auto Fixed line colour. auto resolves via the colour scale.
alpha auto Line opacity in [0, 1].
linetype auto Dash keyword (e.g., "solid", "dashed"). auto honours the linetype scale.
stat "identity" Statistical transform name. Usually "identity".
position "identity" Position adjustment name. Usually "identity".
key auto Legend glyph override built with a draw-key-* helper. auto picks the default for the geom.
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