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.

vectorNode
An arrow from the origin to (3, 2) and a dashed arrow from (−1, −1) to (1, 0).An arrow from the origin to (3, 2) and a dashed arrow from (−1, −1) to (1, 0).

#Attributes

On any plane
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
Defaultgreen
widthAnimatable
Stroke width.
Default2
opacityAnimatable
Opacity.
Default1
dashedAnimatable
Dashed stroke.
Defaultfalse
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 withxplane
dxImplicitAnimatable
X component. Cartesian on the ordinary and polar planes alike; on the argand plane the displacement is z:.
Can be written as shorthand: vector:value
dyAnimatable
Y component. Cartesian on the ordinary and polar planes alike; on the argand plane the displacement is z:.
xAnimatable
X coordinate of the tail. Defaults to 0, so a vector with only dx and dy starts at the origin.
Only withxyplane
dxImplicitAnimatable
X component. Cartesian on the ordinary and polar planes alike; on the argand plane the displacement is z:.
Can be written as shorthand: vector:value
dyAnimatable
Y component. Cartesian on the ordinary and polar planes alike; on the argand plane the displacement is z:.
xAnimatable
X coordinate of the tail. Defaults to 0, so a vector with only dx and dy starts at the origin.
yAnimatable
Y coordinate of the tail.
Only withargandplane
zAnimatable
On 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.
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
dxImplicitAnimatable
X component. Cartesian on the ordinary and polar planes alike; on the argand plane the displacement is z:.
Can be written as shorthand: vector:value
dyAnimatable
Y component. Cartesian on the ordinary and polar planes alike; on the argand plane the displacement is z:.
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.

#Allowed in

#Examples

An arrow from the origin to (3, 2).An arrow from the origin to (3, 2).
canvas.graph{
    vector(x: 0; y: 0; dx: 3; dy: 2)
}(
    x-domain: [-1, 4]
    y-domain: [-1, 3]
)
A dashed arrow from (−1, −1) to (1, 0).A dashed arrow from (−1, −1) to (1, 0).
canvas.graph{
    vector(x: -1; y: -1; dx: 2; dy: 1; dashed: true)
}(
    x-domain: [-2, 2]
    y-domain: [-2, 1]
)

Last updated