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

stackedplot — Create a stacked line chart with one y-axis per plotted variable.

stackedplot creates a chart with vertically aligned axes that share one x-axis. Pass a vector for one series, a matrix to place each column on a separate axes, or paired X,Y data to choose the common x coordinates. Table and timetable forms select plottable variables by name, numeric index, logical mask, or supported selector object. Numeric source data remains in its native single, double, logical, or integer storage for chart-property queries; floating values used by the renderer are derived from that source rather than becoming the chart's authoritative data.

Syntax

s = stackedplot(Y)
s = stackedplot(X, Y)
s = stackedplot(tbl)
s = stackedplot(tbl, vars)
s = stackedplot(..., LineSpec)
s = stackedplot(..., Name, Value)
s = stackedplot(parent, ...)

Inputs

NameTypeRequiredDefaultDescription
YNumericArrayYes—Vector or matrix data. Matrix columns are plotted in separate stacked axes.
XNumericArrayYes—Common x-axis vector.
YNumericArrayYes—Vector or matrix y data.
tblAnyYes—Table or timetable data.
propsAnyVariadic—Variable selectors, line style, and StackedLineChart name-value options.

Returns

NameTypeDescription
sNumericScalarHandle to the StackedLineChart object.

Errors

IdentifierWhenMessage
RunMat:stackedplot:InvalidArgumentInput data, table selectors, line style, parent, or StackedLineChart properties are invalid.stackedplot: invalid argument
RunMat:stackedplot:InternalInternal plotting state update fails.stackedplot: internal operation failed

How stackedplot works

  • Y can be a vector or matrix. Row and column vectors become one stacked axes; matrix columns become separate stacked axes.
  • X must be a vector whose length matches the vector length or matrix row count of Y.
  • Table and timetable inputs select plottable variables by default. Text, cell, struct, and unsupported object variables are skipped unless explicitly selected, in which case the chart errors if no plottable variables remain.
  • vars and DisplayVariables use the shared table variable selector machinery for table inputs, including names, string arrays, cellstr, numeric indices, logical masks, and supported selector objects. DisplayLabels accepts text scalars, string arrays, character arrays, or cell arrays of text scalars.
  • Multiple table or multiple timetable inputs must be the same tabular kind. Matching variable names combine on one stacked axes by default; CombineMatchingNames=false separates them by input.
  • XVariable selects the common x-axis variable from table inputs. It may be one variable shared by all table inputs or one variable per input table. Timetable row times are used automatically, and XVariable is rejected for timetables.
  • LineSpec and line style name-value properties apply to every child line.
  • The returned handle is a stackedplot chart object. get supports Type, Parent, DisplayVariables, SourceTable, XVariable, CombineMatchingNames, XData, YData, XLabel, Title, Visible, GridVisible, XLimits, LineWidth, LineStyle, and Color. YData is a numeric matrix when child lines have matching lengths and a cell array of vectors when multiple source tables have unequal lengths.
  • SourceTable returns a lightweight provenance snapshot with source table classes and variable names rather than embedding the original table objects in plotting registry state.
  • All eight integer classes are accepted for numeric X/Y data and for numeric table-variable selectors. Integer selectors are decoded as exact positive indices, so adjacent uint64 values are never collapsed through binary64 conversion.
  • XData and YData preserve native numeric storage and exact integer values. When all Y columns share a class and length, YData is rebuilt as one same-class matrix; heterogeneous classes or unequal lengths are returned as a cell array of typed vectors.
  • set supports Title, XLabel, DisplayLabels, YLabels, Visible, GridVisible, XLimits, Color, LineStyle, LineWidth, Marker, and MarkerSize. XLimits accepts finite or infinite numeric bounds as long as the range is increasing.
  • Figure handles are accepted as parents. Axes handles, nested grouped DisplayVariables cells, event-table rendering, interactive chart controls, and native provider-side column splitting are not implemented yet. Automatically resident inputs can use an exact owner-aware host fallback, while explicit GPU input requires RunMat mode.

Examples

Plot each matrix column in a separate stacked axes

Y = [1 10; 2 20; 3 30];
s = stackedplot(Y);

Use a common x vector and line style

x = [0 1 2];
Y = [1 10; 2 20; 3 30];
stackedplot(x, Y, '--o', 'LineWidth', 1.5);

Plot selected table variables

T = table([1;2;3], [4;5;6], [7;8;9], 'VariableNames', {'Time','A','B'});
s = stackedplot(T, {'A','B'}, 'XVariable', 'Time');
get(s, 'DisplayVariables')

Combine matching variables from multiple tables

T1 = table([1;2], 'VariableNames', {'A'});
T2 = table([3;4], 'VariableNames', {'A'});
s = stackedplot(T1, T2, 'A');

Using stackedplot with coding agents

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

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

FAQ

Does stackedplot return line handles?⌄

No. RunMat returns a first-class stackedplot chart handle that owns the child line plots and stacked axes.

Does stackedplot preserve gpuArray residency?⌄

Not currently. Matrix and table inputs must be split into stacked axes and grouped child lines, so RunMat materializes inputs before handing each child line to the renderer. This is tracked for the dedicated GPU/provider audit rather than hidden behind a partial fast path.

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 · plotmatrix · plotyy · polarhistogram · polarplot · polarscatter · print · quiver3 · ribbon · saveas · savefig · sphere · 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 stackedplot is executed, line by line, in Rust.

  • View the source for stackedplot 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 stackedplot works
  • Examples
  • Plot each matrix column in a separate stacked axes
  • Use a common x vector and line style
  • Plot selected table variables
  • Combine matching variables from multiple tables
  • Using stackedplot with coding agents
  • FAQ
  • Related Plotting functions
  • 2D Charts
  • 3D & Surface
  • Images
  • Axes & Layout
  • Appearance
  • Handle Access
  • Other
  • Open-source implementation
  • About RunMat