geom-ellipse

Ellipse layer: draws one closed ellipse per row from (x0, y0, a, b, angle).

x0/y0 give the centre in data units; a/b are the semi-major and semi-minor radii in data units; angle is the rotation in radians from the x axis. Each row is sampled into a 64-vertex polygon and rendered through the polygon draw path.

Usage

geom-ellipse(
  mapping: none,
  data: none,
  a: 1,
  b: 1,
  angle: 0,
  n: 64,
  colour: auto,
  fill: auto,
  stroke: none,
  alpha: auto,
  stat: "identity",
  position: "identity",
  inherit-aes: true,
)

Parameters

Parameter Default Description
mapping none Layer-specific aesthetic mapping built with aes. Must map x0, y0. a, b, and angle may be mapped or left to the layer-level fallbacks.
data none Layer-specific dataset. Falls back to the plot data when none.
a 1 Layer-level semi-major radius in data units used when aes(a: ...) is not mapped.
b 1 Layer-level semi-minor radius in data units used when aes(b: ...) is not mapped.
angle 0 Layer-level rotation in radians used when aes(angle: ...) is not mapped.
n 64 Number of polygon vertices sampled around the ellipse.
colour auto Fixed outline colour. auto resolves via the colour scale.
fill auto Fixed fill colour. auto resolves via the fill scale.
stroke none Outline thickness (a Typst length) or stroke dictionary; none disables the outline.
alpha auto Fill opacity in [0, 1].
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

Two ellipses with different radii and rotation.

#let d = (
  (x0: 0, y0: 0, a: 2, b: 1, angle: 0),
  (x0: 1, y0: 1, a: 1, b: 0.5, angle: calc.pi / 4),
)
#plot(
  data: d,
  mapping: aes(x0: "x0", y0: "y0", a: "a", b: "b", angle: "angle"),
  layers: (geom-ellipse(alpha: 0.4),),
  width: 10cm,
  height: 6cm,
)

Two filled ellipses with different centres, semi-axes a and b, and rotation angles rendered as polygons.

Two filled ellipses with different centres, semi-axes a and b, and rotation angles rendered as polygons.

See also

geom-polygon, geom-segment.

Back to top