RunMat
  • Pricing
RunMat
GitHub
GitHub
Sign inTry in browser
DesktopRuntimePhysicsCADAdministrationAgent

Get RunMat updates

New releases, guides and examples.

Product+
  • Runtime
  • GPU
  • Parallel
  • Compile
  • Interop and MEX
  • Simulation
  • MCAD
  • ECAD
  • Enterprise
  • AI integrations
  • Pricing
  • Download
Math+
  • Signal processing
  • Linear algebra
  • Statistics
  • Curve fitting
  • Differential equations
  • Control systems
  • Optimization
  • Finance
  • Data and tables
  • Plotting
Physics+
  • Simulation overview
  • Structural
  • Thermal
  • Electromagnetic
  • Joule heating
  • Thermal stress
  • Acoustics
  • Fluid flow
  • Conjugate heat transfer
  • Fluid–structure
  • What is FEA
Industries+
  • Aerospace
  • Automotive and transportation
  • Defense
  • Electronics and semiconductors
  • Energy
  • Industrial machinery
  • Life sciences
  • Quantitative finance
Learn+
  • Guides
  • Docs
  • Function reference
  • Language reference
  • Migration guide
  • Changelog
  • MATLAB Online
  • MATLAB AI agent
  • For students
Compare+
  • RunMat vs MATLAB
  • RunMat vs Ansys
  • RunMat vs SOLIDWORKS
  • RunMat vs Altium
  • RunMat vs Cadence
  • RunMat vs COMSOL
  • RunMat vs Python
  • RunMat vs Julia
  • RunMat vs Physics AI
  • RunMat vs Octave
  • Benchmarks
  • MATLAB alternatives
  • All comparisons
Company+
  • About
  • Blog
  • Contact
  • Source code↗
  • License
  • Privacy
  • Terms

Product

  • Runtime
  • GPU
  • Parallel
  • Compile
  • Interop and MEX
  • Simulation
  • MCAD
  • ECAD
  • Enterprise
  • AI integrations
  • Pricing
  • Download

Math

  • Signal processing
  • Linear algebra
  • Statistics
  • Curve fitting
  • Differential equations
  • Control systems
  • Optimization
  • Finance
  • Data and tables
  • Plotting

Physics

  • Simulation overview
  • Structural
  • Thermal
  • Electromagnetic
  • Joule heating
  • Thermal stress
  • Acoustics
  • Fluid flow
  • Conjugate heat transfer
  • Fluid–structure
  • What is FEA

Industries

  • Aerospace
  • Automotive and transportation
  • Defense
  • Electronics and semiconductors
  • Energy
  • Industrial machinery
  • Life sciences
  • Quantitative finance

Learn

  • Guides
  • Docs
  • Function reference
  • Language reference
  • Migration guide
  • Changelog
  • MATLAB Online
  • MATLAB AI agent
  • For students

Compare

  • RunMat vs MATLAB
  • RunMat vs Ansys
  • RunMat vs SOLIDWORKS
  • RunMat vs Altium
  • RunMat vs Cadence
  • RunMat vs COMSOL
  • RunMat vs Python
  • RunMat vs Julia
  • RunMat vs Physics AI
  • RunMat vs Octave
  • Benchmarks
  • MATLAB alternatives
  • All comparisons

Company

  • About
  • Blog
  • Contact
  • Source code↗
  • License
  • Privacy
  • Terms
GitHubXLinkedIn

© Dystr, Inc. · RunMat v0.7.1, Nov 17, 2026

RunMat® is a registered trademark of Dystr, Inc. MATLAB® is a registered trademark of The MathWorks, Inc. RunMat is not affiliated with, endorsed by, or sponsored by The MathWorks, Inc.

/
See all docs
Builtin Reference
    • addpoints
    • ancestor
    • animatedline
    • area
    • autumn
    • axes
    • axis
    • bar
    • barh
    • bone
    • box
    • caxis
    • cla
    • clf
    • clim
    • colorbar
    • colorcube
    • colormap
    • colororder
    • contour
    • contour3
    • contourf
    • cool
    • copper
    • copyobj
    • cylinder
    • daspect
    • datacursormode
    • dataTipTextRow
    • drawnow
    • errorbar
    • fcontour
    • figure
    • fill
    • fill3
    • findobj
    • fsurf
    • gca
    • gcf
    • get
    • gobjects
    • gray
    • grid
    • groot
    • heatmap
    • hgload
    • hgsave
    • hidden
    • hist
    • histogram
    • histogram2
    • hold
    • hot
    • image
    • imagesc
    • imshow
    • inferno
    • isgraphics
    • ishandle
    • jet
    • legend
    • line
    • lines
    • linkaxes
    • loglog
    • magma
    • mesh
    • meshc
    • openfig
    • opengl
    • pan
    • parula
    • patch
    • pie
    • pink
    • plasma
    • plot
    • plot3
    • plotmatrix
    • plotyy
    • polarhistogram
    • polarplot
    • polarscatter
    • print
    • quiver
    • quiver3
    • ribbon
    • saveas
    • savefig
    • scatter
    • scatter3
    • semilogx
    • semilogy
    • set
    • sgtitle
    • shading
    • sphere
    • spring
    • stackedplot
    • stairs
    • stem
    • subplot
    • subtitle
    • summer
    • suptitle
    • surf
    • surfc
    • text
    • textscatter
    • textscatter3
    • title
    • triplot
    • turbo
    • view
    • viridis
    • waitbar
    • winter
    • wordcloud
    • xlabel
    • xlim
    • xline
    • xscale
    • xtickangle
    • xtickformat
    • xticklabels
    • xticks
    • ylabel
    • ylim
    • yline
    • yscale
    • ytickangle
    • ytickformat
    • yticklabels
    • yticks
    • zlabel
    • zlim
    • zoom

quiver — Visualize 2-D vector fields with quiver plots in MATLAB and RunMat.

quiver visualizes 2-D vector fields as arrows anchored at data points. Supported call forms, scaling behavior, and returned handle semantics follow MATLAB behavior.

Syntax

h = quiver(U, V)
h = quiver(X, Y, U, V)
h = quiver(X, Y, U, V, LineSpec)
h = quiver(X, Y, U, V, Name, Value, ...)
h = quiver(ax, U, V)
h = quiver(ax, X, Y, U, V)
h = quiver(ax, X, Y, U, V, LineSpec)
h = quiver(ax, X, Y, U, V, Name, Value, ...)

Inputs

U
Type
NumericArray
Required
Yes
Description
Vector field x-components.
V
Type
NumericArray
Required
Yes
Description
Vector field y-components.
X
Type
NumericArray
Required
Yes
Description
X coordinates (vector or matrix).
Y
Type
NumericArray
Required
Yes
Description
Y coordinates (vector or matrix).
lineSpec
Type
StyleSpec
Required
Yes
Description
Line style/color shorthand.
props
Type
Any
Required
Variadic
Description
Name/value quiver style properties.
ax
Type
AxesHandle
Required
Yes
Description
Target axes handle.
NameTypeRequiredDefaultDescription
UNumericArrayYes—Vector field x-components.
VNumericArrayYes—Vector field y-components.
XNumericArrayYes—X coordinates (vector or matrix).
YNumericArrayYes—Y coordinates (vector or matrix).
lineSpecStyleSpecYes—Line style/color shorthand.
propsAnyVariadic—Name/value quiver style properties.
axAxesHandleYes—Target axes handle.

Returns

h
Type
NumericScalar
Description
Handle to the rendered quiver plot.
NameTypeDescription
hNumericScalarHandle to the rendered quiver plot.

Errors

RunMat:quiver:InvalidArgument
When
Input data, axes targeting, or quiver style arguments are invalid.
Message
quiver: invalid argument
RunMat:quiver:Internal
When
Internal quiver construction or rendering fails unexpectedly.
Message
quiver: internal operation failed
RunMat:plotting:TooManyOutputs
When
More than one output is requested from a coordinate chart constructor.
Message
plotting: too many output arguments
IdentifierWhenMessage
RunMat:quiver:InvalidArgumentInput data, axes targeting, or quiver style arguments are invalid.quiver: invalid argument
RunMat:quiver:InternalInternal quiver construction or rendering fails unexpectedly.quiver: internal operation failed
RunMat:plotting:TooManyOutputsMore than one output is requested from a coordinate chart constructor.plotting: too many output arguments

Behavior

quiver(U, V) builds the default coordinate grid from the shape of U and V.

quiver(X, Y, U, V) accepts explicit coordinate vectors or meshgrid-style axes, depending on the input layout.

The returned value is a quiver-handle object that can be queried and updated through get and set.

Auto-scale factor, head size, line width, color, and display-name workflows are all part of the plotting property path.

Dedicated GPU geometry generation keeps vector-field rendering on device when plotting-compatible U/V buffers are available, including quiver(U,V) with an implicit coordinate grid.

Integer X, Y, U, and V inputs retain their exact class, shape, and values in graphics properties and serialized scenes, including 64-bit values beyond binary64's exact range; only the renderer cache crosses the floating geometry boundary.

Options

'AutoScaleFactor' / 'Scale' controls arrow scaling.

'MaxHeadSize' / 'HeadSize' controls the size of arrowheads.

Line-style color and width workflows are supported through the same style parsing and handle/property path used by other line-like plots.

Rendering and residency

quiver uses a GPU-backed floating geometry path and can keep compatible vector-field inputs resident on device when the shared plotting device is available. Native host storage remains authoritative for XData, YData, UData, VData, property access, and scene persistence; renderer buffers and floating geometry are derived caches. Default X/Y grids are represented as compact axis buffers while U/V remain resident, and unsupported integer buffers gather exactly through their owning provider.

quiver preserves GPU residency on the direct path by building arrow geometry from exported GPU U/V buffers. Explicit GPU X/Y coordinates also stay resident when their precision matches U/V. Implicit default X/Y grids are uploaded as compact meshgrid-vector axis buffers, and explicit host X/Y coordinates are uploaded as axis buffers, so resident U/V inputs do not have to be gathered. If the direct geometry path is unavailable for the active input combination, RunMat falls back while preserving the same quiver semantics and handle behavior.

The direct quiver path emits renderer-ready arrow geometry from GPU buffers on the happy path.

Axes-local state and handle/property workflows stay aligned across GPU and fallback rendering paths.

Replay/export paths read back GPU source buffers when serializable plot data is required.

Declared source precision and class coverage

single

double

Coordinate broadcasting

none

Runtime contract and boundaries

Graphics results are host double handles; fill/fill3 may return a row of handles for independently created polygon columns/groups. Sphere instead supports zero through three requested outputs: statement form plots, while output forms return host double coordinate grids. Handle aliases, value-selected options and exact graphics receiver roles are resolved by Runtime, not guessed from scalar facts.

The existing numerical and geometry owners validate coordinates, integer controls, shapes and properties. Single/double and all eight integer source classes retain their native storage wherever the object has authoritative source properties; client geometry and renderer buffers are deliberate floating boundaries, not a promise of exact wide-integer pixel positions. There is no sparse/complex plotting implementation or numeric broadcasting promise here. Logical, scalar, vector, matrix, rank and empty admission follows each documented owner below rather than a universal coercion.

RuntimeOwned preparation retains the original BuiltinArguments through suspension and completion. Eligible direct GPU routes require the live owning provider, admitted precision/storage/shape, compatible exports and installed plotting device. NoAttempt means pre-effect inapplicability, not permission to swallow export, allocation, cancellation or emission errors. Existing provider errors are propagated and ingress errors are terminal Never replay. Source-property queries and figure persistence may require explicit owner-aware readback; surface property snapshots and quiver3/patch construction are not zero-copy routes.

Canonical UserInterface capability and host-callback effects reflect scene creation/presentation; function-sampling entries additionally declare Unknown effects for arbitrary user callbacks and require the Process execution stack. NativeAndWasm means the Runtime entry is portable, not that an absent graphics host is emulated. Portable Runtime linkage introduces no separate native numerical library artifact. Rendering is a fusion boundary and distributed execution is unsupported; no numeric provider kernel or fusion primitive is invented.

Chart scratch, metadata, retained render state and the sphere coordinate builder do not yet have complete finite host allocation ownership. The shared canonical HostAllocationReceipt policy guard refuses Managed work before extraction/gather/callbacks or scene mutation, preserves ordinary Unbounded routes, and checks captured cancellation generation and policy before publication. This is an explicit L25 gap, not allocation completion. Long synchronous geometry/copy loops, renderer/provider-private allocation accounting, full MATLAB property parity, physical performance and actual example execution remain independently required.

Supported representations and remaining forms

Forms are U,V or X,Y,U,V, optional leading axes, and the existing line/name-value style grammar. Input-role discrimination uses typed numeric kinds so implicit-grid styling is not mistaken for explicit coordinates. Default X indexes columns, Y rows; U/V geometry must agree. Coordinates can be full matched data or valid meshgrid vectors, with native source properties retained.

Full axes targets retain both figure and axes identity rather than publishing into the active figure with a foreign index. AutoScaleFactor/Scale, MaxHeadSize/HeadSize and existing Color/LineWidth/DisplayName/Visible controls retain the shared parser. A missing operand after an axes handle is diagnosed, not unwrapped. Native integer scalar coordinates are data, not an undocumented numeric axes alias.

Eligible compatible resident floating U/V can use direct quiver packing, including compact implicit axes and admitted host axes. Integer/unsupported buffer forms take the existing exact owning-provider client route; provider or partial geometry failures propagate rather than replay. Native source properties and renderer caches are distinct lifetimes. Complete MATLAB scale/property/empty-shape parity is not inferred from this migration.

Examples

Create a vector field from U and V only

[X, Y] = meshgrid(-2:0.5:2, -2:0.5:2);
U = -Y;
V = X;
quiver(U, V);

Expected output:

% RunMat infers the coordinate grid from the vector-field shape

Provide explicit coordinates for a flow field

[X, Y] = meshgrid(-2:0.5:2, -2:0.5:2);
U = -Y;
V = X;
quiver(X, Y, U, V);

Adjust arrow scaling and head size through the handle

[X, Y] = meshgrid(-2:0.5:2, -2:0.5:2);
U = -Y;
V = X;
h = quiver(X, Y, U, V);
set(h, 'AutoScaleFactor', 1.5, 'MaxHeadSize', 0.2, 'DisplayName', 'rotation');
legend;

Gradient vector field over a scalar potential

[X, Y] = meshgrid(linspace(-2, 2, 25), linspace(-2, 2, 25));
Z = X .* exp(-X.^2 - Y.^2);
[DX, DY] = gradient(Z, X(1,2)-X(1,1), Y(2,1)-Y(1,1));

contourf(X, Y, Z, 15);
hold on;
quiver(X, Y, DX, DY, 'k', 'LineWidth', 1);
hold off;

colormap('turbo');
colorbar;
title('Gradient Field over Scalar Potential');
xlabel('x');
ylabel('y');

Rendered quiver example

[X, Y] = meshgrid(linspace(-2, 2, 25), linspace(-2, 2, 25));
Z = X .* exp(-X.^2 - Y.^2);
[DX, DY] = gradient(Z, X(1,2)-X(1,1), Y(2,1)-Y(1,1));

contourf(X, Y, Z, 15);
hold on;
quiver(X, Y, DX, DY, 'k', 'LineWidth', 1);
hold off;

colormap('turbo');
colorbar;
title('Gradient Field over Scalar Potential');
xlabel('x');
ylabel('y');
Expected output:
Gradient vectors over a scalar potential rendered with MATLAB quiver and contourf in RunMat

Compare this result with other chart types in the plot examples.

Using quiver with coding agents

Open a RunMat example with live inputs, then ask the agent to explain how quiver changes the result.

Run a small quiver example, explain the result, then change one input and compare the output.

FAQ

How do I control arrow lengths in a quiver plot?⌄

Use the 'AutoScaleFactor' property. A value of 1 means default scaling, 0 disables auto-scaling entirely (arrows drawn at raw data magnitude), and values like 1.5 or 2 make arrows proportionally longer.

h = quiver(X, Y, U, V);
set(h, 'AutoScaleFactor', 0); % raw magnitudes, no auto-scaling
Can I overlay quiver arrows on top of a contourf plot?⌄

Yes. Plot the filled contour first, then call hold on and add the quiver layer. Both share the same axes, so the coordinate grids align automatically.

contourf(X, Y, Z);
hold on;
quiver(X, Y, U, V, 'Color', 'k');
Does RunMat support 3-D quiver plots?⌄

Yes. Use quiver3 for 3-D vector fields.

quiver3(X, Y, Z, U, V, W);

Related Plotting functions

2D Charts

area · bar · errorbar · heatmap · hist · histogram · loglog · pie · plot · scatter · semilogx · semilogy · stairs · stem

3D & Surface

contour · contour3 · contourf · mesh · meshc · plot3 · scatter3 · surf · surfc

Images

image · imagesc · imshow

Axes & Layout

axis · box · grid · sgtitle · subplot · title · view · zlabel

Appearance

colorbar · colormap · legend · shading

Handle Access

gca · gcf · get · set

Other

addpoints · ancestor · animatedline · autumn · axes · barh · bone · caxis · cla · clf · clim · colorcube · colororder · cool · copper · copyobj · cylinder · daspect · datacursormode · dataTipTextRow · drawnow · fcontour · figure · fill · fill3 · findobj · fsurf · gobjects · gray · groot · hgload · hgsave · hidden · histogram2 · hold · hot · inferno · isgraphics · ishandle · jet · line · lines · linkaxes · magma · openfig · opengl · pan · parula · patch · pink · plasma · plotmatrix · plotyy · polarhistogram · polarplot · polarscatter · print · quiver3 · ribbon · saveas · savefig · sphere · spring · stackedplot · subtitle · summer · suptitle · text · textscatter · textscatter3 · triplot · turbo · viridis · waitbar · winter · wordcloud · xlabel · xlim · xline · xscale · xtickangle · xtickformat · xticklabels · xticks · ylabel · ylim · yline · yscale · ytickangle · ytickformat · yticklabels · yticks · zlim · zoom

More plotting resources

  • Choosing the right plot type
  • Styling plots and axes
  • Plot replay and export
  • Complete plotting guide

Source you can read

Every RunMat function's source is public. Read exactly how quiver is executed, line by line, in Rust.

  • View the source for quiver in Rust on GitHub
  • Learn how the RunMat runtime works
  • Found a bug? Open an issue with a minimal reproduction.

About RunMat

RunMat is a runtime that executes MATLAB-syntax code fast on any GPU. The runtime is free for individuals, including freelancers; students and faculty at an academic institution, for teaching or research there; contributors to an open-source project, for work on that project; organizations with 250 or fewer people and US$10M or less in annual revenue; and anyone, for non-production use. See runmat.com/license.

  • RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
  • Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.

Getting started · Benchmarks · Pricing

Download RunMat

Download RunMat for full performance, or use RunMat in your browser for zero setup.

Download RunMatOpen Sandbox
On this page
  • Syntax
  • Inputs
  • Returns
  • Errors
  • Behavior
  • Options
  • Rendering and residency
  • Declared source precision and class coverage
  • Coordinate broadcasting
  • Runtime contract and boundaries
  • Supported representations and remaining forms
  • Examples
  • Create a vector field from U and V only
  • Provide explicit coordinates for a flow field
  • Adjust arrow scaling and head size through the handle
  • Gradient vector field over a scalar potential
  • Rendered quiver example
  • Using quiver with coding agents
  • FAQ
  • Related Plotting functions
  • 2D Charts
  • 3D & Surface
  • Images
  • Axes & Layout
  • Appearance
  • Handle Access
  • Other
  • More plotting resources
  • Source you can read
  • About RunMat