quiver

Plots a 2-D vector field as arrows.

Category: Graphics > 2-D and 3-D Plots

Syntax

quiver(X, Y, U, V)

Draws an arrow at each point (X, Y) with components (U, V).

quiver(U, V)

Places the arrows on an evenly spaced grid.

quiver(___, scale)

Scales the arrow length; 0 turns off the automatic scaling.

quiver(___, LineSpec)

Sets color and style of the arrows.

h = quiver(___)

Also returns the Quiver object.

Description

By default the arrows are scaled so that the longest one does not overlap its neighbors; the lengths therefore show relative magnitudes. Build the grid with meshgrid and compute the components from a formula or from gradient.

Input arguments

X, Y
Arrow base positions.
U, V
Components of the vectors, the same size as X and Y.
scale
Scale factor of the arrow length.

Output arguments

h
Quiver object with UData and VData.

Example

Rotation field

[x, y] = meshgrid(-2:0.5:2);
quiver(x, y, -y, x)
axis equal

In the app, the figure is drawn below the code.

See also

quiver3 streamslice gradient feather meshgrid