RunMat
  • Pricing
RunMat
GitHub
GitHub
DownloadSign InTry in Browser
DesktopRuntimeServer
RunMat

Run math blazing fast

GitHubX (Twitter)LinkedIn

Company

  • About
  • Pricing
  • Contact

Explore

  • RunMat for academia
  • RunMat vs MATLAB Online
  • Benchmarks

Get product updates and release notes from the RunMat team.

© 2026 Dystr · Made withfor the scientific community.

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.

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

plotmatrix — Create a scatter plot matrix from matrix columns.

plotmatrix builds a grid of axes where each off-diagonal subplot compares one variable column against another. The one-input form also places histograms on the diagonal. Matrix rows are observations and columns are variables; vector inputs are treated as one variable.

Syntax

S = plotmatrix(X)
S = plotmatrix(X, LineSpec)
S = plotmatrix(X, Y)
S = plotmatrix(X, Y, LineSpec)
S = plotmatrix(ax, ...)
[S, AX] = plotmatrix(...)
[S, AX, BigAx] = plotmatrix(...)
[S, AX, BigAx, H, HAx] = plotmatrix(X)

Inputs

NameTypeRequiredDefaultDescription
XNumericArrayYes—Matrix whose columns are variables and rows are observations.
lineSpecStyleSpecNo—Optional marker/color style applied to scatter plots.
YNumericArrayYes—Matrix whose columns are variables and rows are observations.

Returns

NameTypeDescription
SNumericArrayMatrix of scatter graphics handles for off-diagonal plots.
AXNumericArrayMatrix of axes handles used by the plot matrix.
BigAxNumericScalarCompatibility axes handle for labels spanning the plot matrix.
HNumericArrayVector of diagonal histogram handles for the one-input form.
HAxNumericArrayVector of diagonal histogram axes handles for the one-input form.

Returned values from plotmatrix depend on how many outputs the caller requests.

Errors

IdentifierWhenMessage
RunMat:plotmatrix:InvalidArgumentInputs are nonnumeric, observation counts differ, or style arguments are malformed.plotmatrix: invalid argument
RunMat:plotmatrix:InternalInternal subplot, scatter, or histogram rendering fails.plotmatrix: internal operation failed

How plotmatrix works

  • plotmatrix(X) creates an n by n grid for the n variables in X, with diagonal histograms and off-diagonal scatter plots.
  • plotmatrix(X,LineSpec) applies the line specification to off-diagonal scatter plots while retaining diagonal histograms.
  • plotmatrix(X,Y) creates an n by m rectangular grid for n columns in X and m columns in Y; diagonal histogram outputs are empty for this form.
  • plotmatrix(X,Y,lineSpec) applies the line specification to scatter plots in the matrix.
  • plotmatrix(ax,...) uses the supplied axes as the compatibility big-axes target.
  • [S,AX,BigAx,H,HAx] = plotmatrix(X) returns the scatter handle matrix, axes handle matrix, current big-axes handle, diagonal histogram handles, and diagonal histogram axes handles.
  • Inputs must be numeric and must have the same number of observations when both X and Y are supplied.
  • Diagonal histograms are created through the same histogram builtin path as direct histogram calls.

Examples

Plot pairwise relationships between columns

X = [1 10; 2 20; 3 30; 4 40];
S = plotmatrix(X);

Compare X columns against a separate response column

X = [1 10; 2 20; 3 30];
Y = [4; 5; 6];
[S,AX] = plotmatrix(X, Y, 'r+');

Inspect diagonal histogram handles

X = [1 10; 2 20; 3 30];
[S,AX,BigAx,H,HAx] = plotmatrix(X);
numel(H)

Expected output:

ans =
     2

Using plotmatrix with coding agents

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

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

FAQ

Does plotmatrix preserve gpuArray residency?⌄

No. plotmatrix is a CPU-rendered plotting sink, matching MATLAB's documented gpuArray behavior for this function. Individual scatter/histogram rendering then follows the existing plotting paths.

What is BigAx in RunMat?⌄

RunMat returns a valid axes handle and leaves it as gca so scripts can pass it to labeling/property helpers. The current renderer does not model MATLAB's invisible spanning axes as a distinct object.

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 · 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 · axes · barh · caxis · cla · clf · clim · colorcube · colororder · copyobj · daspect · datacursormode · dataTipTextRow · fcontour · figure · fill · fill3 · findobj · fsurf · gobjects · groot · hgload · hgsave · hidden · histogram2 · hold · line · linkaxes · openfig · opengl · pan · parula · patch · plotyy · polarhistogram · polarplot · polarscatter · print · quiver3 · ribbon · saveas · savefig · sphere · stackedplot · subtitle · suptitle · text · textscatter · textscatter3 · triplot · waitbar · wordcloud · xlabel · xlim · xline · xscale · xtickangle · xtickformat · xticklabels · xticks · ylabel · ylim · yline · yscale · ytickangle · ytickformat · yticklabels · yticks · zlim · zoom

Open-source implementation

Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how plotmatrix is executed, line by line, in Rust.

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

About RunMat

RunMat is an open-source runtime that executes MATLAB-syntax code blazing on any GPU. It is licensed under the Apache 2.0 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
  • How plotmatrix works
  • Examples
  • Plot pairwise relationships between columns
  • Compare X columns against a separate response column
  • Inspect diagonal histogram handles
  • Using plotmatrix with coding agents
  • FAQ
  • Related Plotting functions
  • 2D Charts
  • 3D & Surface
  • Images
  • Axes & Layout
  • Appearance
  • Handle Access
  • Other
  • Open-source implementation
  • About RunMat