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

area — Create filled area plots in MATLAB and RunMat.

area creates filled area plots from vector or matrix-style inputs. It returns one area handle per plotted series, supports baseline and stacked behaviors, and participates in the shared MATLAB/RunMat plotting handle-property system.

Syntax

h = area(Y)
h = area(Y, LineSpec)
h = area(Y, basevalue)
h = area(Y, Name, Value, ...)
h = area(X, Y)
h = area(X, Y, LineSpec)
All supported area forms
h = area(Y)
h = area(Y, LineSpec)
h = area(Y, basevalue)
h = area(Y, Name, Value, ...)
h = area(X, Y)
h = area(X, Y, LineSpec)
h = area(X, Y, basevalue)
h = area(X, Y, Name, Value, ...)
h = area(ax, Y)
h = area(ax, Y, Name, Value, ...)
h = area(ax, Y, basevalue)
h = area(ax, X, Y)
h = area(ax, X, Y, Name, Value, ...)
h = area(ax, X, Y, basevalue)

Inputs

Y
Type
NumericArray
Required
Yes
Description
Y data vector or matrix. Columns are rendered as stacked series.
lineSpec
Type
StyleSpec
Required
Yes
Description
Line/color shorthand such as '--r'.
basevalue
Type
NumericScalar
Required
Yes
Description
Horizontal baseline value.
props
Type
Any
Required
Variadic
Description
Name/value style properties such as Color, LineWidth, and BaseValue.
X
Type
NumericArray
Required
Yes
Description
X coordinates matching the row count of Y.
ax
Type
AxesHandle
Required
Yes
Description
Target axes handle.
NameTypeRequiredDefaultDescription
YNumericArrayYes—Y data vector or matrix. Columns are rendered as stacked series.
lineSpecStyleSpecYes—Line/color shorthand such as '--r'.
basevalueNumericScalarYes—Horizontal baseline value.
propsAnyVariadic—Name/value style properties such as Color, LineWidth, and BaseValue.
XNumericArrayYes—X coordinates matching the row count of Y.
axAxesHandleYes—Target axes handle.

Returns

h
Type
NumericArray
Description
Area graphics handle or handle row vector, with one handle per plotted series.
NameTypeDescription
hNumericArrayArea graphics handle or handle row vector, with one handle per plotted series.

Errors

RunMat:area:InvalidArgument
When
Input data, style tokens, or name/value options are invalid.
Message
area: invalid argument
RunMat:area:Internal
When
Renderer/GPU conversion fails during chart construction.
Message
area: internal operation failed
RunMat:plotting:TooManyOutputs
When
More than one output is requested from a coordinate chart constructor.
Message
plotting: too many output arguments
IdentifierWhenMessage
RunMat:area:InvalidArgumentInput data, style tokens, or name/value options are invalid.area: invalid argument
RunMat:area:InternalRenderer/GPU conversion fails during chart construction.area: internal operation failed
RunMat:plotting:TooManyOutputsMore than one output is requested from a coordinate chart constructor.plotting: too many output arguments

Behavior

area(y) uses implicit x-values 1:n, while area(x, y) uses explicit x coordinates.

If explicit x-values are not increasing, each series is sorted by x before rendering; integer x-values are ordered in their native class before conversion to graphics coordinates.

Matrix-style y inputs create stacked area series in the MATLAB style.

Vector y returns one area handle, while matrix y returns a row vector with one handle for each column; every handle works with get and set.

Baseline and color workflows flow through the shared plotting property model.

All eight integer classes are accepted for X, Y, BaseValue, and LineWidth; integer plot data crosses one explicit client graphics conversion boundary.

Compatible floating stacked-series geometry can be emitted directly from GPU buffers on the RunMat acceleration path.

Options

A positional numeric scalar or 'BaseValue' name-value pair sets the baseline used by area filling.

'LineWidth' accepts a positive numeric scalar, including every integer class.

Color and display-name workflows are available through the returned handle and the shared plotting property path.

Rendering and residency

Documented GPU-array inputs execute on the client. RunMat additionally preserves compatible floating-point data on a GPU-backed geometry path; resident integer data gathers exactly before the graphics conversion.

The documented GPU-array surface executes on the client, so resident integer X and Y gather with typed storage intact and convert only at the graphics boundary. RunMat preserves floating-point residency on a compatible direct path, including stacked-series geometry generation; other inputs use the semantics-preserving fallback.

The direct RunMat area path emits filled geometry from compatible floating GPU data when X is implicit or a known nondecreasing host vector.

Resident integer data and explicit resident X gather on the client so exact integer ordering and documented sorting occur before conversion.

Baseline semantics, stacked-series behavior, and one-handle-per-series output remain aligned across direct and fallback 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

Real single/double and all native integer X/Y classes are supported; logical, complex and sparse representations are rejected by area_numeric_input. Y-only, X/Y, leading axes and positional/name-value baseline forms use the existing area parser. Matrix Y accumulates ordered columns into stacked upper/lower series. Native integer X is sorted before its deliberate f64 client-graphics conversion; matrix X must match the plotting shape, rather than borrowing a normalized empty geometry.

Numeric BaseValue and LineWidth controls retain the existing scalar validation and integer rules. LineSpec is the declared RunMat-only extension, not full MATLAB syntax parity. Non-vector/empty compatibility is constrained by the current area shape owner and is not certified as MATLAB parity. Current area property mutation implements Color and BaseValue; FaceAlpha is not implemented, and property acceptance elsewhere must not be confused with changing renderer transparency.

Examples

Create a basic filled area plot

x = 0:0.1:1;
area(x, x.^2);

Create stacked area series from a matrix

x = 1:5;
Y = [1 2 1; 2 1 2; 3 2 1; 2 3 2; 1 2 3];
area(x, Y);

Change the baseline and label the series through the handle

x = 0:0.2:2;
h = area(x, sin(x) + 2);
set(h, 'BaseValue', 1, 'DisplayName', 'offset area');
legend;

Stacked energy mix

years = 2018:2025;
solar   = [5  8  12 18 25 33 42 50];
wind    = [10 14 18 22 28 32 36 40];
hydro   = [30 30 29 28 27 27 26 26];
mix = [solar; wind; hydro]';

area(years, mix);
title('Energy Generation Mix');
xlabel('Year');
ylabel('TWh');
legend('Solar', 'Wind', 'Hydro');
grid on;

Rendered area example

years = 2018:2025;
solar   = [5  8  12 18 25 33 42 50];
wind    = [10 14 18 22 28 32 36 40];
hydro   = [30 30 29 28 27 27 26 26];
mix = [solar; wind; hydro]';

area(years, mix);
title('Energy Generation Mix');
xlabel('Year');
ylabel('TWh');
legend('Solar', 'Wind', 'Hydro');
grid on;
Expected output:
Solar, wind, and hydro generation rendered as a stacked MATLAB area plot in RunMat

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

Using area with coding agents

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

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

FAQ

How do I create a stacked area chart?⌄

Pass a matrix as the y-data. Each column becomes a stacked series, and RunMat accumulates them vertically so the total is visible at the top.

x = 1:6;
Y = [2 3 1; 1 2 2; 3 1 2; 2 2 3; 1 3 1; 2 1 3];
area(x, Y);
legend('A', 'B', 'C');
How do I control the transparency of an area plot?⌄

MATLAB supports FaceAlpha values from 0 (fully transparent) to 1 (fully opaque) for overlaying area series. The following retained program illustrates that MATLAB syntax, not implemented RunMat transparency mutation.

area(x, y1);
hold on;
h = area(x, y2);
set(h, 'FaceAlpha', 0.4);

RunMat currently implements area Color and BaseValue mutation; apply_area_property has no FaceAlpha branch, so accepting a property token elsewhere must not be interpreted as changing transparency.

What's the difference between area and plot?⌄

area fills the region between the data line and the baseline, giving a visual sense of cumulative magnitude. plot just draws the line. Use area when the filled region conveys meaning—cumulative totals, part-to-whole breakdowns, or emphasizing the magnitude of a signal relative to a baseline.

Related Plotting functions

2D Charts

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

  • View the source for area 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
  • Rendering and residency
  • Direct floating rendering precisions
  • Coordinate broadcasting
  • Runtime contract and boundaries
  • Supported representations and remaining forms
  • Examples
  • Create a basic filled area plot
  • Create stacked area series from a matrix
  • Change the baseline and label the series through the handle
  • Stacked energy mix
  • Rendered area example
  • Using area 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