brace

A curly brace spanning from one point to another, with its label at the tip.

braceNode
Only withxxyargandpolarplane
A grey rectangle with a brace along its bottom edge labelled w and a teal brace up its right side labelled h.A grey rectangle with a brace along its bottom edge labelled w and a teal brace up its right side labelled h.

A brace spans two points with a curly brace and sets its label at the tip: brace(start: (0, 0); end: (4, 0); label: $R$). It names a distance anywhere in the picture, where an axis.brace names an interval on an axis. It bows to the left of the direction from start to end, so swapping the ends, or flip, puts it on the other side. depth is in pixels, like an angle's radius; left off, it is 7% of the span, between 14 and 36 px. Space takes no brace.


#Attributes

startRequiredImplicitAnimatable
The point the span begins at, as a coordinate pair. Written first, and the brace bows to the left of the direction from here to end.
Also written: fromCan be written as shorthand: brace:value
endRequiredAnimatable
The point it ends at.
Also written: to
label
What the span is called, at the brace's tip — rich text, so $maths$ renders. A brace with nothing to say is a bracket; the name is the reason to draw one.
flipAnimatable
Bows to the other side of the line, without swapping the two ends round.
Defaultfalse
depthAnimatable
How far the brace bows out, in pixels. When not given it grows with the span — 7% of it, between 14 and 36 px — so a wide brace keeps its shoulders and point.
colourAnimatable
The brace's colour, and its label's.
colour
Also written: color
Defaultneutral
widthAnimatable
Stroke thickness.
Default1.5
opacityAnimatable
Opacity of the whole mark, 0 to 1.
Default1
text-sizeAnimatable
Label text size.
Default16
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
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.
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 stroke of the first the graph's key: gives one, over its own colour: and dashed, and the footer's key names every group.

#Allowed in

#Examples

A brace along the x axis from 0 to 4, labelled w.A brace along the x axis from 0 to 4, labelled w.
graph{
    brace(start: (0, 0); end: (4, 0); label: $w$)
}(
    x-domain: [-1, 5]
    y-domain: [-2, 2]
)
A teal upright brace from (3, 0) to (3, 2.4), labelled H.A teal upright brace from (3, 0) to (3, 2.4), labelled H.
graph{
    brace(start: (3, 0); end: (3, 2.4); label: $H$; colour: teal)
}(
    x-domain: [0, 5]
    y-domain: [-0.5, 3]
)
A slanted brace from (1, 1) to (4, 3), flipped to the other side and deeper, labelled d.A slanted brace from (1, 1) to (4, 3), flipped to the other side and deeper, labelled d.
graph{
    brace(start: (1, 1); end: (4, 3); label: $d$; depth: 14; flip)
}(
    x-domain: [0, 5]
    y-domain: [0, 4]
)

Last updated