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

scatter3 — Create 3-D scatter plots with marker size/color encodings using MATLAB-compatible scatter3 forms.

scatter3 creates 3-D marker plots from matching x/y/z coordinates and returns a graphics handle. It supports MATLAB-compatible forms for marker sizing, coloring, fill options, axes targeting, and plot property updates.

Syntax

h = scatter3(X, Y, Z)
h = scatter3(X, Y, Z, S)
h = scatter3(X, Y, Z, S, C)
h = scatter3(X, Y, Z, LineSpec)
h = scatter3(X, Y, Z, Name, Value, ...)
h = scatter3(ax, X, Y, Z)
All supported scatter3 forms
h = scatter3(X, Y, Z)
h = scatter3(X, Y, Z, S)
h = scatter3(X, Y, Z, S, C)
h = scatter3(X, Y, Z, LineSpec)
h = scatter3(X, Y, Z, Name, Value, ...)
h = scatter3(ax, X, Y, Z)
h = scatter3(ax, X, Y, Z, S)
h = scatter3(ax, X, Y, Z, S, C)
h = scatter3(ax, X, Y, Z, LineSpec)
h = scatter3(ax, X, Y, Z, Name, Value, ...)

Inputs

X
Type
NumericArray
Required
Yes
Description
X coordinates.
Y
Type
NumericArray
Required
Yes
Description
Y coordinates.
Z
Type
NumericArray
Required
Yes
Description
Z coordinates.
S
Type
NumericArray
Required
Yes
Description
Marker area specification.
C
Type
Any
Required
Yes
Description
Color specification (uniform, per-point scalar, or RGB matrix).
lineSpec
Type
StyleSpec
Required
Yes
Description
Marker/line style shorthand.
props
Type
Any
Required
Variadic
Description
Name/value marker style properties.
ax
Type
AxesHandle
Required
Yes
Description
Target axes handle.
NameTypeRequiredDefaultDescription
XNumericArrayYes—X coordinates.
YNumericArrayYes—Y coordinates.
ZNumericArrayYes—Z coordinates.
SNumericArrayYes—Marker area specification.
CAnyYes—Color specification (uniform, per-point scalar, or RGB matrix).
lineSpecStyleSpecYes—Marker/line style shorthand.
propsAnyVariadic—Name/value marker style properties.
axAxesHandleYes—Target axes handle.

Returns

h
Type
NumericScalar
Description
Handle to the rendered 3-D scatter plot.
NameTypeDescription
hNumericScalarHandle to the rendered 3-D scatter plot.

Errors

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

Behavior

scatter3(x, y, z) requires matching element counts across all three inputs; MATLAB documents all eight integer classes for each coordinate and for marker size S.

The builtin returns a scatter handle for the created plot object.

3-D scatter plots work naturally with view and zlabel, and all camera state remains subplot-local.

Host X/Y/Z graphics properties and FIG scene payloads retain authoritative f64, f32, or native integer class, shape, and exact values. A derived f32 vertex cache is used only for rendering and never becomes property or serialization authority.

GPU-resident coordinate buffers can feed the renderer directly on the supported single/double path; otherwise RunMat gathers exactly through the handle's owning provider before plotting.

Marker size and display-name style workflows are handled through the shared plotting object/property system.

Rendering and residency

scatter3 is a rendering sink. GPU inputs can stay resident when the shared plotting device consumes exported buffers directly.

scatter3 preserves GPU residency when the plotting path can consume exported single/double coordinate buffers directly. If a direct path is unavailable, RunMat gathers through the input handle's owning provider and renders the same plot semantics on the host path; host integer source data remains exact and authoritative independently of renderer materialization.

The preferred path keeps point buffers on the device and emits renderer-ready geometry without a full host round-trip.

Subplot, view, and object-handle behavior is the same on both the GPU and fallback host paths.

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.

Coordinate counts must agree and the point constructor rejects empty data. Shapes are retained as source properties while all elements form one point series; full MATLAB matrix-per-column scatter expansion is not implemented. S defaults when empty, accepts scalar or per-point areas, and is converted to floating points-squared rendering metadata. C accepts a named/uniform color, scalar-value vector or per-point RGB/RGBA matrix according to the shared PointArgs owner. Filled, Marker, MarkerSize, MarkerFaceColor, MarkerEdgeColor, LineWidth, DisplayName and visibility use that existing style parser; malformed lengths/shapes and unsupported properties retain its diagnostics.

The three-dimensional scatter object exposes XData/YData/ZData with native source class and shape. It shares the scatter handle Type, but uses its dedicated 3-D numeric/render owner and subplot-local camera state. Direct floating exports and bounds/emission remain subject to exact provider/device ownership and terminal after-effect failures.

Examples

Plot a 3-D helix as a point cloud

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

Style a 3-D scatter plot and change the camera view

t = linspace(0, 4*pi, 200);
h = scatter3(cos(t), sin(t), t);
set(h, 'DisplayName', 'helix', 'SizeData', 10);
view(45, 25);

Use subplot-local camera state with multiple 3-D plots

subplot(1, 2, 1);
scatter3(1:10, rand(1,10), rand(1,10));
view(3);
subplot(1, 2, 2);
scatter3(rand(1,10), rand(1,10), rand(1,10));
view(2);

Expected output:

% The two subplots keep independent 3-D view state

3D point cloud with color-coded altitude

n = 2000;
theta = 4*pi*rand(1, n);
r = sqrt(rand(1, n));
x = r .* cos(theta);
y = r .* sin(theta);
z = sin(3*r) ./ (1 + r);

scatter3(x, y, z, 12, z, 'filled');
colormap('turbo');
colorbar;
title('3-D Point Cloud — Altitude Encoded');
xlabel('x');
ylabel('y');
zlabel('z');
view(35, 25);
grid on;

Rendered scatter3 example

rng(11);
n = 2000;
theta = 4*pi*rand(1, n);
r = sqrt(rand(1, n));
x = r .* cos(theta);
y = r .* sin(theta);
z = sin(3*r) ./ (1 + r);

scatter3(x, y, z, 12, z, 'filled');
colormap('turbo');
colorbar;
title('3-D Point Cloud - Altitude Encoded');
xlabel('x');
ylabel('y');
zlabel('z');
view(35, 25);
grid on;
Expected output:
Three-dimensional point cloud colored by altitude and rendered with MATLAB scatter3 in RunMat

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

Using scatter3 with coding agents

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

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

FAQ

How do I size scatter3 points by a data variable?⌄

Pass a size vector as the fourth argument, for example scatter3(cos(t), sin(t), t, sizes). Each element controls the corresponding marker area; a scalar fourth argument sets every point to the same size.

Can I color scatter3 points by a fourth variable?⌄

Pass a color vector as the fifth argument after the size vector, for example scatter3(x, y, z, 20, myValues). Each value maps through the active colormap; add colorbar to show the mapping.

How do I rotate or orbit a scatter3 plot?⌄

Use view(az, el) to set the camera angle programmatically. az is the horizontal orbit in degrees, el is the vertical tilt. view(3) gives the standard 3-D default. Each subplot keeps its own independent camera state, so you can show the same data from multiple angles in a subplot grid.

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

  • View the source for scatter3 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
  • Plot a 3-D helix as a point cloud
  • Style a 3-D scatter plot and change the camera view
  • Use subplot-local camera state with multiple 3-D plots
  • 3D point cloud with color-coded altitude
  • Rendered scatter3 example
  • Using scatter3 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