polygon

A closed shape whose outline is its x: and y: vertex series, paired by position. The named shapes take a position and a size; a polygon takes its outline directly.

polygonNode
Only withxyargandpolarplane
A filled triangle and a teal outlined triangle overlapping it.A filled triangle and a teal outlined triangle overlapping it.

#Attributes

On any plane
slice
The 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.
fillAnimatable
Fill polygon.
Also written: filled
Defaulttrue
colourAnimatable
Colour.
bluelight-bluedark-blueredlight-reddark-redorangelight-orangedark-orangeyellowlight-yellowdark-yellowteallight-tealdark-tealgreenlight-greendark-greenpinklight-pinkdark-pinkpurplelight-purpledark-purplegreylight-greydark-greyneutralhex(…)rgb(…)
Also written: color
Defaultteal
opacityAnimatable
Opacity.
Default1
dashedAnimatable
Draws the outline dashed. What it is for is the shape that is not there: where a figure was before it moved, a region a constraint rules out, a construction that explains the drawing without being part of it.
Defaultfalse
interpolateAnimatable
How 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.
linearbezier
Also written: interpolation
Defaultlinear
label
Text drawn beside the element — rich text, so $maths$ and inline formatting render. Fades and draws with the element.
hiddenAnimatable
Declared 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.
Defaultfalse
lock
Keeps the reader from editing this element on an editable: graph. Nothing at all on a graph that is not editable.
Also written: locked
Defaultfalse
text-sizeAnimatable
Text size.
Default20
layerAnimatable
Paint order among the marks: a higher layer is drawn later, on top; equal or omitted, the marks stack in document order (later on top). Written z: before the argand plane took that letter for its coordinate.
Only withxyplane
xImplicitAnimatable
The 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:value
yAnimatable
The vertices' y coordinates, paired with x by position.
Only withargandplane
zAnimatable
On 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.
reAnimatable
On the argand plane, the readings' real parts, one per reading — numbers written out or a column — paired with im by position.
imAnimatable
On the argand plane, the readings' imaginary parts, paired with re by position.
Only withpolarplane
rAnimatable
On the polar plane, the readings' distances from the origin, paired with theta by position.
thetaAnimatable
On the polar plane, the readings' angles in radians (60deg for degrees), paired with r by position; names on a categorical theta.

#Allowed in

#Examples

A filled triangle with corners at (0, 0), (2, 0) and (1, 2).A filled triangle with corners at (0, 0), (2, 0) and (1, 2).
canvas.graph{
    polygon(x: 0, 2, 1; y: 0, 0, 2)
}
A teal triangle drawn as an outline only.A teal triangle drawn as an outline only.
canvas.graph{
    polygon(x: -1, 1, 0; y: -1, -1, 1; fill: false; colour: teal)
}

Last updated