polygon
A closed shape whose outline is its vertex series.
polygonOnly with
xyargandpolarxyzplane

#Attributes
On any plane
sliceThe column this mark is SLICED by — long-format data, one row per thing per slice, showing the one the scene's parameter over that column holds. A column with a number line interpolates, so a reader stopped between two values sees half way; a column of names selects the rows carrying the name they picked.
colourColour.
paintAlso written:
colorDefault
tealopacityOpacity.
Default
1fill-styleHow the inside is filled:
solid; hatched, ruled with diagonal lines over a pale wash of the colour; dotted, stippled with dots over the wash; or outlined, no fill, the edge alone.solidhatcheddottedoutlinedDefault
solidstroke-styleHow the edge is drawn:
solid, dashed or dotted. An outlined, dashed polygon is the shape that is not there — where a figure was before it moved, a region a constraint rules out.soliddasheddottedDefault
solidinterpolateHow the outline gets from one vertex to the next:
linear for straight sides, bezier for a closed round outline, on the same midpoint handles as the line’s. No step — a staircase is a reading against x, and a closed outline is not one.linearbezierAlso written:
interpolationDefault
linearlabelText drawn beside the element — rich text, so
$maths$ and inline formatting render. Fades and draws with the element.hiddenDeclared but not drawn. Animatable —
hidden: true !cue.to{false}(at: 2) reveals it — and unlike a cue, a hidden element still frames the plot, so the axes do not jump when it appears.Default
falselockKeeps the reader from editing this element on an
editable: graph. Nothing at all on a graph that is not editable.Also written:
lockedDefault
falsetext-sizeText size.
Default
20layerPaint order among the marks: a higher layer is drawn later, on top; equal or omitted, the marks stack in document order, later on top.
groupThe groups this mark belongs to, comma-separated:
group: Early sown, Projected. It is drawn in the colour of the first that has one and the style of the first the graph's key: gives one, unless it writes its own colour: or style, and the footer's key names every group.Only with
xyplaneOnly with
argandplanezOn the argand plane, the readings as complex numbers: written out (
1 + i, 2 - i, -3i, a bare number a real), or a column of complex literals bound whole (#roots.z). Instead of re/im. In space, the vertices' z coordinates, paired with x and y by position.reOn the argand plane, the readings' real parts, one per reading — numbers written out or a column — paired with
im by position.imOn the argand plane, the readings' imaginary parts, paired with
re by position.Only with
polarplaneOnly with
xyzplanexThe vertices' x coordinates, e.g.
0, 2, 1. Numbers or a dataset column; entries may be expressions of parameters.Can be written as shorthand:
polygon:valueyThe vertices' y coordinates, paired with
x by position.zOn the argand plane, the readings as complex numbers: written out (
1 + i, 2 - i, -3i, a bare number a real), or a column of complex literals bound whole (#roots.z). Instead of re/im. In space, the vertices' z coordinates, paired with x and y by position.#Derived attributes
Computed while the element renders — read one with #id.name in attribute position or {{#id.name}} in prose, never set.
areaThe area the outline encloses, in square units of the plane (or the box), rounded where
interpolate: bezier rounds it; a dash with fewer than three vertices, or where an axis is a log scale, names or dates.perimeterThe length of the closed outline in the plane's units, rounded where
interpolate: bezier rounds it; a dash where area is.#Allowed in
#Examples


graph{
polygon(x: 0, 2, 1; y: 0, 0, 2)
}

graph{
polygon(x: -1, 1, 0; y: -1, -1, 1; fill-style: outlined; colour: teal)
}

graph:xyz{
polygon(x: 2, 0, 0; y: 0, 2, 0; z: 0, 0, 2; colour: purple)
}(
x domain: [0, 2]
y domain: [0, 2]
z domain: [0, 2]
aspect: equal
)#Notes
- In space the face is filled and shaded as the surface it spans.