grid — Toggle grid lines for charts, subplots, and MATLAB grid on / grid off workflows.
grid controls the visibility of axes grid lines on the active subplot or axes selection. It supports the familiar MATLAB command-style forms grid on, grid off, and bare grid toggling, while returning the resulting boolean state in RunMat.
How grid works in RunMat
grid onenables grid lines on the current axes.grid offdisables grid lines on the current axes.- Calling
gridwith no argument toggles the current 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 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;Related functions to explore
These functions work well alongside grid. Each page has runnable examples you can try in the browser.
Open-source implementation
Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how grid works, line by line, in Rust.
- View grid.rs on GitHub
- Learn how the 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 — faster, on any GPU, with no license required.
- Simulations that took hours now take minutes. RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed.
- Start running code in seconds. Open the browser sandbox or download a single binary. No license server, no IT ticket, no setup.
- A full development environment. GPU-accelerated 2D and 3D plotting, automatic versioning on every save, and a browser IDE you can share with a link.