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

plot3 — Create 3-D line plots in MATLAB and RunMat.

plot3 creates line plots in 3-D space from matching x, y, and z inputs. Returned handle behavior and plotting integration follow MATLAB semantics.

Syntax

h = plot3(X, Y, Z)
h = plot3(X, Y, Z, LineSpec)
h = plot3(X, Y, Z, Name, Value, ...)
h = plot3(ax, X, Y, Z)
h = plot3(ax, X, Y, Z, LineSpec)
h = plot3(ax, X, Y, Z, Name, Value, ...)
h = plot3(X1, Y1, Z1, ..., Xn, Yn, Zn)
h = plot3(ax, X1, Y1, Z1, ..., Xn, Yn, Zn)

Inputs

X
Type
NumericArray
Required
Yes
Description
X data.
Y
Type
NumericArray
Required
Yes
Description
Y data.
Z
Type
NumericArray
Required
Yes
Description
Z data.
lineSpec
Type
StyleSpec
Required
Yes
Description
Line style/color shorthand.
props
Type
Any
Required
Variadic
Description
Name/value style properties.
ax
Type
AxesHandle
Required
Yes
Description
Target axes handle.
series
Type
Any
Required
Variadic
Description
Interleaved X/Y/Z series triplets with optional per-series style tokens.
NameTypeRequiredDefaultDescription
XNumericArrayYes—X data.
YNumericArrayYes—Y data.
ZNumericArrayYes—Z data.
lineSpecStyleSpecYes—Line style/color shorthand.
propsAnyVariadic—Name/value style properties.
axAxesHandleYes—Target axes handle.
seriesAnyVariadic—Interleaved X/Y/Z series triplets with optional per-series style tokens.

Returns

h
Type
NumericScalar
Description
Handle to the first 3-D line object in the rendered series.
NameTypeDescription
hNumericScalarHandle to the first 3-D line object in the rendered series.

Errors

RunMat:plot3:InvalidArgument
When
Input data, series grammar, axes targeting, or style arguments are invalid.
Message
plot3: invalid argument
RunMat:plot3:Internal
When
Internal 3-D line construction or rendering fails unexpectedly.
Message
plot3: internal operation failed
IdentifierWhenMessage
RunMat:plot3:InvalidArgumentInput data, series grammar, axes targeting, or style arguments are invalid.plot3: invalid argument
RunMat:plot3:InternalInternal 3-D line construction or rendering fails unexpectedly.plot3: internal operation failed

Behavior

plot3(x, y, z) requires matching element counts in all three inputs.

The builtin returns a 3-D line handle that can be inspected and updated through get and set.

Multiple 3-D series in one call create multiple line objects and return the handle for the first created series.

plot3 is camera-aware and naturally pairs with view and zlabel in the subplot-local 3-D state model.

GPU-backed 3-D line rendering is used when the shared plotting device can consume exported buffers directly.

Rendering and residency

plot3 uses the dedicated 3-D line rendering path and can keep plotting-compatible GPU inputs resident on device.

plot3 preserves GPU residency for multi-point GPU coordinate inputs when the 3-D line pipeline can consume exported buffers directly. Single-point GPU inputs gather once because they render through the scatter-style point fallback rather than the line-segment packer.

The dedicated 3-D line pipeline is separate from 2-D plot, which keeps camera-aware rendering and bounds handling explicit.

Subview state, labels, and line object behavior remain identical across GPU and host fallback paths.

Plot replay/export can read back preserved GPU source buffers from the line object when host coordinate vectors were not materialized at construction time.

Direct floating rendering precisions

single

double

Coordinate broadcasting

none

Runtime contract and boundaries

The result is a host graphics handle, not a numeric coordinate array. Coordinate parsing, native source storage, series expansion, style validation and graphics state use the existing plotting owners. Numeric handle aliases are resolved at Runtime, so static inference does not guess that a scalar coordinate denotes axes. The line, bar, barh and area constructors may return a row of handles; the other identities return the first created handle. More than one language output is rejected before chart work.

Single and double source data use their native storage where the chart has typed source properties; all eight integer classes use the declared identity-specific coordinate/control rules. Rendering is an explicit floating geometry boundary. In particular errorbar, bar, barh and area convert client graphics data to floating geometry; this does not certify exact integer-valued rendered pixels. Complex, logical, sparse, empty and matrix admission is decided by each existing numerical/shape parser, not by this shared ingress. Unsupported representations raise the existing parser diagnostic rather than being assumed fully MATLAB compatible.

Direct GPU rendering is conditional on the actual owning provider, live physical input leases, floating class/storage, supported shape/style, compatible shared device exports and native plotting feature availability. A pre-effect unavailable direct route may take the existing client path; a failed or partially completed export/reduction/emission is terminal and never permission to replay on the host. Source-property reads and figure persistence can perform later explicit readback. There is no elementwise/reduction fusion, distributed execution or portable numeric provider kernel for these graphics sinks.

User-interface capability and host-callback effects describe graphics creation/presentation, not numeric purity. Portable Runtime linking and an ordinary execution stack allow Native and Wasm ingress; actual presentation requires the installed graphics host. Retained chart data, style metadata, renderer buffers and serialization are separate lifetimes. Current chart scratch/state has no complete finite allocation owner: Managed policy is rejected before argument extraction, gather or chart mutation through the existing HostAllocationReceipt authority. Ordinary Unbounded resident and host routes remain available. Issuer/policy/cancellation are fenced before publication and errors carry Never replay. This refusal, unbounded host loops, provider/renderer-private allocations, full property parity and measured performance remain open obligations; Incomplete/Partial is not a completion certificate.

Supported representations and remaining forms

Coordinates use real single/double Tensor storage or native integer storage. Scalar logical coordinates pass through the existing NumericInput double conversion; logical arrays, complex arrays, sparse arrays, categorical and datetime coordinate objects do not have a NumericInput representation and are not implemented by this chart owner.

Each explicit X/Y/Z triple must have equal, nonzero element counts. Repeated triples create ordered series and return the first handle; a matrix triple is one flattened trajectory rather than full MATLAB matrix-column expansion. LineSpec color/line style, LineStyleOrder, LineWidth, DisplayName and visibility are supported. Marker LineSpec/Marker requests are explicitly rejected until Line3 marker rendering exists. Compatible multi-point floating device triples use the direct Line3 preparation owner; single-point device inputs use the established client point fallback.

Examples

Create a 3-D helix

t = linspace(0, 6*pi, 300);
plot3(cos(t), sin(t), t);

Plot multiple 3-D trajectories and label them

t = linspace(0, 4*pi, 200);
h1 = plot3(cos(t), sin(t), t);
set(h1, 'DisplayName', 'helix A');
hold on;
h2 = plot3(cos(t), sin(t), -t);
set(h2, 'DisplayName', 'helix B');
legend;

Control the camera and z-axis after plotting

t = linspace(0, 4*pi, 150);
h = plot3(cos(t), sin(t), t);
zlabel('Height');
view(45, 20);
get(h, 'Type')

Expected output:

ans =
    'line'

Rendered plot3 example

t = linspace(0, 8*pi, 600);
radius = 1 + 0.12*cos(5*t);
x = radius.*cos(t);
y = radius.*sin(t);
z = linspace(0, 6, 600) + 0.12*sin(3*t);

h = plot3(x, y, z);
set(h, 'LineWidth', 2);
title('Helical Sensor Trajectory');
xlabel('x (m)');
ylabel('y (m)');
zlabel('z (m)');
view(38, 26);
grid on;
axis equal;
Expected output:
Helical sensor trajectory rendered as a connected MATLAB plot3 path in RunMat

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

Using plot3 with coding agents

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

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

FAQ

How do I plot a 3-D trajectory from parametric equations?⌄

Generate a parameter vector t, compute x(t), y(t), z(t), and pass all three to plot3. The line connects points in parameter order.

t = linspace(0, 10*pi, 500);
plot3(sin(t), cos(t), t);
zlabel('z');
Can I overlay plot3 lines with scatter3 points?⌄

Yes — use hold on between calls. Both plot3 and scatter3 share the same 3-D axes and camera state, so they compose directly.

t = linspace(0, 4*pi, 200);
plot3(cos(t), sin(t), t);
hold on;
scatter3(cos(t(1:20:end)), sin(t(1:20:end)), t(1:20:end));
How do I control the camera angle on a plot3 figure?⌄

Call view(az, el) after plotting. az is the azimuth (horizontal rotation) and el is the elevation (vertical tilt), both in degrees. view(3) gives the default 3-D perspective. Camera state is subplot-local, so each subplot can have its own angle.

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 · quiver · 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 plot3 is executed, line by line, in Rust.

  • View the source for plot3 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
  • Rendering and residency
  • Direct floating rendering precisions
  • Coordinate broadcasting
  • Runtime contract and boundaries
  • Supported representations and remaining forms
  • Examples
  • Create a 3-D helix
  • Plot multiple 3-D trajectories and label them
  • Control the camera and z-axis after plotting
  • Rendered plot3 example
  • Using plot3 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