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

plot — Create 2-D line plots in MATLAB and RunMat.

plot creates 2-D line charts from plot(y), plot(x, y), and multi-series call forms. Returned handle behavior and plotting-property integration follow MATLAB semantics.

Syntax

h = plot(Y)
h = plot(Y, LineSpec)
h = plot(Y, Name, Value, ...)
h = plot(X, Y)
h = plot(X, Y, LineSpec)
h = plot(X, Y, Name, Value, ...)
All supported plot forms
h = plot(Y)
h = plot(Y, LineSpec)
h = plot(Y, Name, Value, ...)
h = plot(X, Y)
h = plot(X, Y, LineSpec)
h = plot(X, Y, Name, Value, ...)
h = plot(ax, Y)
h = plot(ax, X, Y)
h = plot(ax, X, Y, LineSpec)
h = plot(ax, X, Y, Name, Value, ...)
h = plot(X1, Y1, ..., Xn, Yn)
h = plot(ax, X1, Y1, ..., Xn, Yn)

Inputs

Y
Type
NumericArray
Required
Yes
Description
Y data; X defaults to 1:numel(Y).
lineSpec
Type
StyleSpec
Required
Yes
Description
Line style/color shorthand.
props
Type
Any
Required
Variadic
Description
Name/value style properties.
X
Type
NumericArray
Required
Yes
Description
X data.
Y
Type
NumericArray
Required
Yes
Description
Y data.
ax
Type
AxesHandle
Required
Yes
Description
Target axes handle.
series
Type
Any
Required
Variadic
Description
Interleaved X/Y series pairs with optional per-series style tokens.
NameTypeRequiredDefaultDescription
YNumericArrayYes—Y data; X defaults to 1:numel(Y).
lineSpecStyleSpecYes—Line style/color shorthand.
propsAnyVariadic—Name/value style properties.
XNumericArrayYes—X data.
YNumericArrayYes—Y data.
axAxesHandleYes—Target axes handle.
seriesAnyVariadic—Interleaved X/Y series pairs with optional per-series style tokens.

Returns

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

Errors

RunMat:plot:InvalidArgument
When
Input data, series grammar, axes targeting, or style arguments are invalid.
Message
plot: invalid argument
RunMat:plot:Internal
When
Internal line construction or rendering fails unexpectedly.
Message
plot: internal operation failed
RunMat:plot:TooManyOutputs
When
More than one output is requested.
Message
plot: too many output arguments
IdentifierWhenMessage
RunMat:plot:InvalidArgumentInput data, series grammar, axes targeting, or style arguments are invalid.plot: invalid argument
RunMat:plot:InternalInternal line construction or rendering fails unexpectedly.plot: internal operation failed
RunMat:plot:TooManyOutputsMore than one output is requested.plot: too many output arguments

Behavior

plot(y) uses 1:n as the implicit x-axis, matching MATLAB shorthand behavior.

plot(x, y) requires the same element count in both inputs. Row and column vectors are both accepted.

Multiple data pairs in one call create multiple line objects and return the handle for the first created series, matching common MATLAB plotting conventions.

The returned handle works with get and set, so line color, width, display names, and marker properties can be inspected or updated after plotting.

Plotting is subplot-local. If the active axes come from subplot, the line is attached to that subplot rather than globally mutating every axes in the figure.

RunMat treats plot as a rendering sink: fusion stops at the builtin, but GPU residency is preserved on the happy path when the shared plotting device is installed.

Options

Style strings like '-', '--', ':', 'o', 'x', and combined forms such as 'r--o' are accepted in MATLAB-style plot calls, including per-series forms such as plot(x1,y1,'r',x2,y2,'b').

Name/value property updates can be supplied inline or applied after plotting through set(h, ...), where h is the returned line handle. Inline line-spec tokens may appear before or after name/value pairs for a series.

HandleVisibility accepts 'on', 'off', and 'callback'; 'off' keeps the line visible but removes it from automatic legend entries.

Display names set during or after plotting are used by legend when labels are not passed explicitly.

GPU residency

Plot is a rendering sink. GPU inputs can remain resident when the shared plotting device is available; otherwise RunMat gathers once before rendering.

plot preserves GPU residency when the plotting context can consume exported GPU buffers directly. If the active plotting path cannot use the input buffers, RunMat gathers once before rendering while keeping the resulting figure semantics unchanged.

On the GPU happy path, RunMat reuses exported plot input buffers and emits renderer-ready line geometry without a full host round-trip.

Marker-heavy or otherwise unsupported combinations can fall back to host materialization while preserving the same visible result and handle semantics.

Execution

plot is a rendering sink, not an elementwise or reduction fusion primitive. Floating GPU line paths accept single and double data without broadcasting. Native integer coordinate data remain authoritative in line source properties; rendering crosses an explicit floating geometry boundary. Integer resident inputs gather through the existing typed owner because direct WGPU lines are floating-only.

Zero requested outputs still constructs the plot. At most one numeric line handle is published. The first created series supplies that handle; additional series remain accessible through the existing graphics property owners.

Examples

Plot paired x/y data as a basic line chart

x = linspace(0, 2*pi, 200);
y = sin(x);
h = plot(x, y);

Expected output:

% h is a numeric handle for the first line object

Use MATLAB-style y-only shorthand

samples = [1 4 2 5 3];
plot(samples);

Expected output:

% RunMat uses 1:length(samples) for the x-axis

Create multiple series and drive the legend from display names

x = linspace(0, 2*pi, 200);
h1 = plot(x, sin(x));
set(h1, 'DisplayName', 'sin(x)', 'LineWidth', 2);
hold on;
h2 = plot(x, cos(x));
set(h2, 'DisplayName', 'cos(x)');
legend;

Expected output:

% The legend uses the line DisplayName properties

Use per-series LineSpec and line properties

x = 1:3;
y = [1 2 3];
plot(x, y, 'r', x, y + 1, 'b');
h = plot(x, y, 'LineWidth', 1.2, 'b', 'HandleVisibility', 'off');

Expected output:

% The first call creates red and blue series; h is visible but excluded from automatic legends

Inspect and update a plotted line through handles

x = 0:0.1:1;
h = plot(x, x.^2);
get(h, 'Type')
set(h, 'Color', 'r', 'Marker', 'o', 'MarkerSize', 6);

Expected output:

ans =
    'line'

Damped oscillation with envelope

t = linspace(0, 4*pi, 500);
envelope = exp(-0.3*t);
signal = envelope .* sin(5*t);

h1 = plot(t, signal);
set(h1, 'DisplayName', 'Damped signal', 'LineWidth', 1.5);
hold on;
h2 = plot(t, envelope, '--');
set(h2, 'DisplayName', 'Envelope', 'LineWidth', 1.5, 'Color', [0.85 0.33 0.1]);
h3 = plot(t, -envelope, '--');
set(h3, 'DisplayName', '-Envelope', 'LineWidth', 1.5, 'Color', [0.85 0.33 0.1]);
hold off;

title('Damped Oscillation');
xlabel('Time (s)');
ylabel('Amplitude');
legend;
grid on;

Rendered plot example

t = linspace(0, 4*pi, 500);
envelope = exp(-0.3*t);
signal = envelope .* sin(5*t);

h1 = plot(t, signal);
set(h1, 'DisplayName', 'Damped signal', 'LineWidth', 1.5);
hold on;
h2 = plot(t, envelope, '--');
set(h2, 'DisplayName', 'Envelope', 'LineWidth', 1.5, 'Color', [0.85 0.33 0.1]);
h3 = plot(t, -envelope, '--');
set(h3, 'DisplayName', '-Envelope', 'LineWidth', 1.5, 'Color', [0.85 0.33 0.1]);
hold off;

title('Damped Oscillation');
xlabel('Time (s)');
ylabel('Amplitude');
legend();
grid on;
Expected output:
Damped oscillation and its upper and lower envelopes rendered as a MATLAB line plot in RunMat

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

Using plot with coding agents

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

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

FAQ

How do I plot multiple series on the same axes?⌄

Call hold on between plot calls. Each subsequent plot adds a new line to the current axes instead of replacing the previous one.

x = linspace(0, 2*pi, 200);
plot(x, sin(x));
hold on;
plot(x, cos(x));
legend('sin', 'cos');

You can also pass multiple x/y pairs in a single plot call, e.g. plot(x, sin(x), x, cos(x)), though you lose per-series handle control that way.

What line styles and markers does plot accept?⌄

Style strings combine a color code, a line style, and a marker in any order. Line styles: '-' (solid), '--' (dashed), ':' (dotted), '-.' (dash-dot). Markers: 'o', 'x', '+', '*', 's' (square), 'd' (diamond), '^', 'v'. Colors: 'r', 'g', 'b', 'k', 'm', 'c', 'y'. For example, plot(x, y, 'r--o') draws a red dashed line with circle markers.

When should I use plot vs scatter?⌄

plot draws connected lines between points and is the right choice for continuous data or time-series. scatter draws unconnected markers and supports per-point size and color encoding through SizeData and CData. If you just want a line chart, use plot. If you need to encode a third variable via marker size or color, use scatter.

Related Plotting functions

2D Charts

area · bar · errorbar · heatmap · hist · histogram · loglog · pie · 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 · 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 plot is executed, line by line, in Rust.

  • View the source for plot 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
  • GPU residency
  • Execution
  • Examples
  • Plot paired x/y data as a basic line chart
  • Use MATLAB-style y-only shorthand
  • Create multiple series and drive the legend from display names
  • Use per-series LineSpec and line properties
  • Inspect and update a plotted line through handles
  • Damped oscillation with envelope
  • Rendered plot example
  • Using plot 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