square

A square centred at a position on a graph.

squareNode
Only withxyargandpolarplane
On this page
A filled square and, beside it, a smaller teal outlined square standing on the same line.A filled square and, beside it, a smaller teal outlined square standing on the same line.

#Attributes

On any plane
colourAnimatable
Colour.
paint
Also written: color
Defaultpurple
fill-styleAnimatable
How 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.
solidhatcheddottedoutlined
Defaultsolid
stroke-styleAnimatable
How the edge is drawn: solid, dashed or dotted. An outlined, dashed shape is the shape that is not there — where a figure was before it moved, a region a constraint rules out.
soliddasheddotted
Defaultsolid
opacityAnimatable
Opacity.
Default1
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.
lengthAnimatable
The side, in data units: corners sit at (x ± length/2, y ± length/2).
Default2
group
The 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 withxyplane
xImplicitAnimatable
X coordinate.
Can be written as shorthand: square:value
yAnimatable
Y coordinate.
Only withargandplane
zAnimatable
On the argand plane, the position as one complex number — a complex expression: 3 + 2i, (3 + 2i)^2, sqrt(13) * e^(i * a), with i the unit and parameters read as complex. Instead of re/im.
reAnimatable
On the argand plane, the real part of the position, a number; with im. z: gives both at once.
imAnimatable
On the argand plane, the imaginary part of the position, a number; with re. z: gives both at once.
Only withpolarplane
rAnimatable
On the polar plane, the distance from the origin; with theta.
thetaAnimatable
On the polar plane, the angle anticlockwise from the right, in radians — 60deg writes it in degrees; with r. On a categorical theta (theta format:), a name.

#Derived attributes

Computed while the element renders — read one with #id.name in attribute position or {{#id.name}} in prose, never set.

areaDerived
The shape's area in square data units, with length: as its side; on the ordinary, argand and polar planes, and a dash where an axis is a log scale, names or dates, or length: does not resolve.
perimeterDerived
The length of the shape's outline in data units, with length: as its side; a dash where area is.

#Allowed in

#Examples

A filled square at the origin.A filled square at the origin.
graph{
    square(x: 0; y: 0; length: 4)
}
A smaller square, translucent.A smaller square, translucent.
graph{
    square(x: 1; y: -1; length: 2.4; opacity: 0.6)
}

#Notes

  • One of seven shape marks — circle, square, rectangle, triangle, star, diamond, hexagon — that differ only in the outline drawn.

Last updated