Skip to content

petal ​

Draws a petal: a wedge whose sides follow the enclosing coordinate system's angular and radial axes. It is the polar counterpart of rect, for flower and rose glyphs where a rectangle's straight sides would look wrong.

python
from gofish import chart, stack, petal, polar

chart(seafood, coord=polar()) \
    .flow(stack(by="species", dir="x")) \
    .mark(petal(w="count", fill="species")) \
    .render(w=300, h=300)

Signature ​

python
petal(*, x=None, cx=None, x2=None, w=None, em_x=None,
      y=None, cy=None, y2=None, h=None, em_y=None,
      dims=None,
      fill=None, stroke=None, stroke_width=None) -> Mark

Use it inside a polar() or clock() coordinate space, where w/h read as the angular and radial extents. dims={"theta": ..., "r": ...} names the same two axes by their polar names (see Axis names).

Parameters ​

A polar-only wedge/petal shape (Petal.tsx). Box geometry via the shared dims channels.

OptionTypeDefaultDescription
fillstrFill color, or a field name for a color scale.
strokestrStroke color. Defaults to fill.
stroke_widthfloat0Stroke width in pixels.
debugboolDev-only flag: logs this mark's key and datum to the console as it is built. It changes nothing about what is drawn.

Box dimensions ​

OptionTypeDefaultDescription
xint | float | strLeft edge position.
cxint | float | strCenter x.
x2int | float | strRight edge position.
wint | float | strWidth.
em_xboolEmbed x in the parent's x space.
yint | float | strStart edge on y: the top edge where y reads top-down, the bottom edge where it grows upward.
cyint | float | strCenter y.
y2int | float | strOther y edge position.
hint | float | strHeight.
em_yboolEmbed y in the parent's y space.
dimsdictBox dimensions by axis name: x/y, or a name the enclosing coordinate space declares (polar theta/r, geo lon/lat). Each value is a position (like x) or an interval {min, center, max, size, embedded}.