segment
A straight line between two points, stopping at both.
segmentOn this page


A segment is the straight line between two points, segment(start: (0, 0); end: (2, 1)), stopping at both. Animated, end: (2, 1) !cue.to{(4, 3)}(at: 1) moves the end in a straight line; width animates the same way. ticks draws congruence hatches across its middle: segments with the same number are the same length, as an angle's arcs mark equal angles. style is its stroke, solid, dashed or dotted; a dashed segment draws a line that is not part of the figure itself, such as a construction line or where a side stood before it moved.
start and end each take a written point or a list of points another mark publishes, such as a fit's #trend.fitted and #trend.readings. Two lists pair item by item as far as the shorter goes, one segment to each pair; a written point against a list fans out to every point in it.
segment(start: #trend.fitted; end: #trend.readings; colour: orange; style: dashed)colour is per segment: one colour for all of them, a list, or a list of numbers applied to colours, #trend.residuals -> (..<0: blue; 0..: red). It is fixed once drawn, and takes no !cue.to.
#Attributes
startstart: (2, 1), or (x, y, z) in space. Animatable as a whole, so !cue.to{(4, 3)} moves the end in a straight line.segment-endfromCan be written as shorthand: segment:valueendend: (6, 9).segment-endtocolourcolour-stylecolorgreywidth2opacity1stylesolid, dashed or dotted. One value for the whole segment.soliddasheddottedsolidticksangle's arcs mark equal angles.0label$maths$ and inline formatting render. Fades and draws with the element.hiddenhidden: 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.falselockeditable: graph. Nothing at all on a graph that is not editable.lockedfalsetext-size20layergroupgroup: 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.#Derived attributes
Computed while the element renders — read one with #id.name in attribute position or {{#id.name}} in prose, never set.
lengthxyplaneanglelength is a dash, or for a segment of no length.argandplaneanglelength is a dash, or for a segment of no length.polarplaneanglelength is a dash, or for a segment of no length.#Allowed in
#Examples


graph{
segment(start: (0, 0); end: (2, 1))
}(
x-domain: [-1, 3]
y-domain: [-1, 2]
)

graph{
segment(start: (0, 0); end: (2, 3); ticks: 1)
segment(start: (2, 3); end: (4, 0); ticks: 1)
segment(start: (0, 0); end: (4, 0))
}

graph:xyz{
segment(start: (0, 0, 0); end: (2, 0, 0))
segment(start: (0, 0, 0); end: (0, 2, 0))
segment(start: (0, 0, 0); end: (0, 0, 2))
segment(start: (2, 0, 0); end: (0, 2, 0); style: dashed)
segment(start: (0, 2, 0); end: (0, 0, 2); style: dashed)
segment(start: (0, 0, 2); end: (2, 0, 0); style: dashed)
}(
x domain: [0, 2]
y domain: [0, 2]
z domain: [0, 2]
)