box — Toggle axes box outlines in MATLAB and RunMat plotting.
box controls whether the current axes draw their outer frame. It supports box on, box off, and toggle form with no argument, matching MATLAB and RunMat plotting command behavior.
Syntax
enabled = box()
enabled = box(mode)Inputs
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
mode | StringScalar | No | "toggle" | Box mode token ('on'|'off'). |
Returns
| Name | Type | Description |
|---|---|---|
enabled | LogicalArray | Box outline enabled state after command execution. |
Errors
| Identifier | When | Message |
|---|---|---|
RunMat:box:InvalidArgument | Box mode argument is unsupported. | box: invalid argument |
How box works
box onenables the axes frame on the current axes.box offdisables the axes frame on the current axes.- Calling
boxwith no argument toggles the current state. - Box state is subplot-local and applies to the currently active axes.
Examples
Turn the axes frame on for a chart
plot(1:5, [1 4 2 5 3]);
box on;Style subplots independently
subplot(1, 2, 1);
plot(1:5, 1:5);
box off;
subplot(1, 2, 2);
plot(1:5, [5 4 3 2 1]);
box on;Using box with coding agents
Open a RunMat example with live inputs, then ask the agent to explain how box changes the result.
Run a small box example, explain the result, then change one input and compare the output.
FAQ
When should I turn the box off?⌄
Turn box off for a cleaner, more modern chart style — especially for presentations or publications where the top and right frame edges add visual noise without carrying data. Many style guides prefer open axes (left + bottom only) for scatter plots and line charts.
Does box interact with grid or axis settings?⌄
box, grid, and axis are independent axes-state commands. Turning box off removes the outer frame but doesn't touch grid lines or axis limits. You can combine them freely: box off; grid on; axis tight; is a common clean-chart recipe.
Related Plotting functions
More plotting resources
Open-source implementation
Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how box is executed, line by line, in Rust.
- View the source for box 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.