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

grid — Toggle axes grid lines in MATLAB and RunMat plotting.

grid controls visibility of major and minor axes grid lines on the active axes or subplot. Command forms such as grid on, grid off, grid minor, and toggle behavior follow MATLAB semantics.

Syntax

enabled = grid()
enabled = grid(mode)

Inputs

NameTypeRequiredDefaultDescription
modeStringScalarNo"toggle"Grid mode token ('on'|'off'|'minor').

Returns

NameTypeDescription
enabledLogicalArrayGrid enabled state after command execution.

Errors

IdentifierWhenMessage
RunMat:grid:InvalidArgumentGrid mode argument is unsupported.grid: invalid argument

How grid works

  • grid on enables grid lines on the current axes.
  • grid off disables major and minor grid lines on the current axes.
  • grid minor toggles minor grid lines without changing the major grid state.
  • Calling grid with no argument toggles the major grid state.
  • Grid visibility is subplot-local and does not spill into other axes automatically.

Examples

Enable grid lines on a simple line chart

plot(1:5, [1 4 2 5 3]);
grid on;

Toggle minor grid lines on the current axes

plot(1:10, sin(1:10));
grid minor;

Toggle grid lines in one subplot only

subplot(1, 2, 1);
plot(1:5, 1:5);
grid off;
subplot(1, 2, 2);
plot(1:5, [5 4 3 2 1]);
grid on;

Using grid with coding agents

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

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

FAQ

Does RunMat support minor grid lines?⌄

Yes. Use grid minor or grid('minor') to toggle minor grid lines on the active axes. grid off disables both major and minor grid lines.

Can I style the grid line color or width?⌄

Grid styling is tied to axes properties. You can adjust the grid appearance through the axes handle with set(gca, 'GridColor', [0.5 0.5 0.5]) and related properties when the axes property path supports them. Check get(gca) to see what's currently exposed.

Does grid state carry across subplots?⌄

No. Grid visibility is subplot-local. Calling grid on in one panel doesn't turn it on in others — you need to enable it explicitly in each subplot where you want grid lines.

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

  • View the source for grid 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 grid works
  • Examples
  • Enable grid lines on a simple line chart
  • Toggle minor grid lines on the current axes
  • Toggle grid lines in one subplot only
  • Using grid 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