vector
An arrow from (x, y) along (dx, dy). dx is the implicit attribute, and the tail sits at the origin unless x and y move it.
vector

#Attributes
On any plane
colourColour.
bluelight-bluedark-blueredlight-reddark-redorangelight-orangedark-orangeyellowlight-yellowdark-yellowteallight-tealdark-tealgreenlight-greendark-greenpinklight-pinkdark-pinkpurplelight-purpledark-purplegreylight-greydark-greyneutralhex(…)rgb(…)colorDefault
greenwidthStroke width.
Default
2opacityOpacity.
Default
1dashedDashed stroke.
Default
falselabelText 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). Written
z: before the argand plane took that letter for its coordinate.Only with
xplanedxX component. Cartesian on the ordinary and polar planes alike; on the argand plane the displacement is
z:.Can be written as shorthand:
vector:valuedyY component. Cartesian on the ordinary and polar planes alike; on the argand plane the displacement is
z:.xX coordinate of the tail. Defaults to 0, so a vector with only dx and dy starts at the origin.
Only with
xyplanedxX component. Cartesian on the ordinary and polar planes alike; on the argand plane the displacement is
z:.Can be written as shorthand:
vector:valuedyY component. Cartesian on the ordinary and polar planes alike; on the argand plane the displacement is
z:.xX coordinate of the tail. Defaults to 0, so a vector with only dx and dy starts at the origin.
yY coordinate of the tail.
Only with
argandplanezOn the argand plane, the number the arrow IS — a complex expression (
3 + 2i, (1 + i)^2, e^(i * a), i the unit) drawn from the tail out by this displacement. dx/dy are not read there.reOn the argand plane, the real part of the position, a number; with
im. z: gives both at once.imOn the argand plane, the imaginary part of the position, a number; with
re. z: gives both at once.Only with
polarplanedxX component. Cartesian on the ordinary and polar planes alike; on the argand plane the displacement is
z:.Can be written as shorthand:
vector:valuedyY component. Cartesian on the ordinary and polar planes alike; on the argand plane the displacement is
z:.rOn the polar plane, the distance from the origin; with
theta.thetaOn 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.#Allowed in
#Examples


canvas.graph{
vector(x: 0; y: 0; dx: 3; dy: 2)
}(
x-domain: [-1, 4]
y-domain: [-1, 3]
)

canvas.graph{
vector(x: -1; y: -1; dx: 2; dy: 1; dashed: true)
}(
x-domain: [-2, 2]
y-domain: [-2, 1]
)