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

mesh — Create wireframe surface plots in MATLAB and RunMat.

mesh creates wireframe surface plots from vector axes or meshgrid-style coordinates plus height data. Handle behavior and axis integration follow MATLAB semantics.

Syntax

h = mesh(Z)
h = mesh(X, Y, Z)
h = mesh(Z, Name, Value, ...)
h = mesh(X, Y, Z, Name, Value, ...)

Inputs

NameTypeRequiredDefaultDescription
ZNumericArrayYes—Surface height grid.
XNumericArrayYes—X axis vector/meshgrid matrix matching Z columns.
YNumericArrayYes—Y axis vector/meshgrid matrix matching Z rows.
propsAnyVariadic—Name/value surface style options.

Returns

NameTypeDescription
hNumericScalarHandle to the rendered mesh surface.

Errors

IdentifierWhenMessage
RunMat:mesh:InvalidArgumentSurface input arrays or style name/value arguments are invalid.mesh: invalid argument
RunMat:mesh:InternalInternal surface generation/render preparation fails unexpectedly.mesh: internal operation failed

How mesh works

  • mesh(Z) uses implicit axes, while mesh(X, Y, Z) accepts vector axes or meshgrid-style coordinate matrices.
  • XData, YData, and ZData retain native single, double, or integer class and exact host values even when renderer geometry is materialized into a floating domain.
  • The documented independent color-array and leading-axes forms are not implemented yet; this is a general graphics-surface gap rather than an integer coercion rule.
  • The builtin returns a surface handle, so mesh plots can still be inspected through the graphics-object system.
  • mesh is the wireframe-oriented companion to surf; for combined wireframe plus contour overlays, use meshc.
  • RunMat uses the shared surface pipeline for mesh rendering, so view, z-axis labeling, and subplot-local state behave consistently across the surface family.
  • GPU-backed rendering is preferred when the plotting device can consume exported buffers directly; automatic resident inputs also take one exact owner-aware host snapshot for property queries and figure persistence.

Examples

Create a wireframe mesh from a height field

[X, Y] = meshgrid(linspace(-2, 2, 60), linspace(-2, 2, 60));
Z = sin(X.^2 + Y.^2);
mesh(X, Y, Z);

Compare wireframe presentation with subplot-local state

subplot(1, 2, 1);
[X, Y] = meshgrid(linspace(-2, 2, 40), linspace(-2, 2, 40));
Z = cos(X) .* sin(Y);
mesh(X, Y, Z);
view(3);
subplot(1, 2, 2);
surf(X, Y, Z);
view(3);

Inspect the returned surface handle from mesh

[X, Y] = meshgrid(1:20, 1:20);
Z = X + Y;
h = mesh(X, Y, Z);
get(h, 'Type')

Expected output:

ans =
    'surface'

Saddle surface showing grid structure

[X, Y] = meshgrid(linspace(-3, 3, 60), linspace(-3, 3, 60));
Z = X.^2 - Y.^2;

mesh(X, Y, Z);
colormap('jet');
colorbar;
title('Hyperbolic Paraboloid');
xlabel('x');
ylabel('y');
zlabel('z = x^2 - y^2');
view(40, 30);
Expected output:
Saddle surface showing grid structure

Compare this result with other chart types in the MATLAB Plot Gallery.

Using mesh with coding agents

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

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

FAQ

Can I get a filled surface instead of wireframe?⌄

That's what surf is for. mesh draws only the grid lines with transparent faces, while surf fills the faces with colormap-derived colors. If you want the wireframe look but with partial fill, there's no built-in blend — use surf with a low alpha or switch to mesh and accept the wireframe.

How do I combine a mesh with contour lines underneath?⌄

Use meshc instead of mesh. It draws the same wireframe surface but projects contour lines onto the base plane automatically.

[X, Y] = meshgrid(linspace(-2, 2, 50));
Z = sin(X.^2 + Y.^2);
meshc(X, Y, Z);
Can I control transparency on a mesh plot?⌄

Mesh plots don't have filled faces to make transparent — the faces are already open. If you need a semi-transparent surface, use surf and set the FaceAlpha property on the returned handle. The wireframe edges on mesh are always fully opaque.

Related Plotting functions

2D Charts

area · bar · errorbar · heatmap · hist · histogram · loglog · pie · plot · scatter · semilogx · semilogy · stairs · stem

3D & Surface

contour · contour3 · contourf · 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 · 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

More plotting resources

  • Choosing the right plot type
  • Styling plots and axes
  • Plot replay and export
  • Complete plotting guide

Open-source implementation

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

  • View the source for mesh 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 mesh works
  • Examples
  • Create a wireframe mesh from a height field
  • Compare wireframe presentation with subplot-local state
  • Inspect the returned surface handle from mesh
  • Saddle surface showing grid structure
  • Using mesh with coding agents
  • FAQ
  • Related Plotting functions
  • 2D Charts
  • 3D & Surface
  • Images
  • Axes & Layout
  • Appearance
  • Handle Access
  • Other
  • More plotting resources
  • Open-source implementation
  • About RunMat