vector

An arrow from a tail along a displacement.

vectorNode
On this page
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
dzAnimatable
Z component, in space only. There the tail is x/y/z and the arrow is dx/dy/dz.
colourAnimatable
Colour.
paint
Also written: color
Defaultgreen
widthAnimatable
Stroke width.
Default2
opacityAnimatable
Opacity.
Default1
styleAnimatable
How the arrow is drawn: solid, dashed or dotted. One value for the whole vector.
soliddasheddotted
Defaultsolid
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.
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 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. Defaults to 0.
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; dx and dy are not taken there. In space, the z coordinate of the tail.
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.
Only withxyzplane
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. Defaults to 0.
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; dx and dy are not taken there. In space, the z coordinate of the tail.

#Derived attributes

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

On any plane
lengthDerived
The arrow's length from tail to head as drawn, in the plane's units (in space, the box's) — through the graph's transform: where it has one; a dash where an axis is a log scale, names or dates.
Only withxyplane
angleDerived
The arrow's direction, in degrees anticlockwise from the positive x axis, in [0, 360); a dash where length is a dash, or for an arrow of no length.
Only withargandplane
angleDerived
The arrow's direction, in degrees anticlockwise from the positive x axis, in [0, 360); a dash where length is a dash, or for an arrow of no length.
Only withpolarplane
angleDerived
The arrow's direction, in degrees anticlockwise from the positive x axis, in [0, 360); a dash where length is a dash, or for an arrow of no length.

#Allowed in

#Examples

An arrow from the origin to (3, 2).An arrow from the origin to (3, 2).
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).
graph{
    vector(x: -1; y: -1; dx: 2; dy: 1; style: dashed)
}(
    x-domain: [-2, 2]
    y-domain: [-2, 1]
)
In space: two vectors u and v from the origin and their cross product u × v standing perpendicular to both.In space: two vectors u and v from the origin and their cross product u × v standing perpendicular to both.
graph:xyz{
    vector(dx: 2; dy: 0; dz: 0; label: $\mathbf{u}$)
    vector(dx: 0; dy: 2; dz: 0; colour: blue; label: $\mathbf{v}$)
    vector(dx: 0; dy: 0; dz: 2; colour: orange; label: $\mathbf{u} \times \mathbf{v}$)
    surface(expression: 0; opacity: 0.2)
}(
    x domain: [-1, 3]
    y domain: [-1, 3]
    z domain: [-1, 3]
    aspect: equal
)

#Notes

  • dx and dy are both required; in space dx, dy and dz all are.

Last updated