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
mode- Type
StringScalar- Required
- No
- Description
- Box mode token ('on'|'off').
Returns
enabled- Type
LogicalArray- Description
- Box outline enabled state after command execution.
Errors
RunMat:box:InvalidArgument- When
- Box mode argument is unsupported.
- Message
box: invalid argument
RunMat:box:TooManyOutputs- When
- More than one output is requested.
- Message
box: at most one output is supported
Behavior
box on enables the axes frame on the current axes.
box off disables the axes frame on the current axes.
Calling box with no argument toggles the current state.
Box state is subplot-local and applies to the currently active axes.
An assigned logical state/success result is a RunMat extension. MATLAB compatibility mode allows command calls but rejects an explicitly requested result before changing state.
Placement and display
These commands update shared graphics state and may notify figure observers. Numeric array acceleration remains with the original plotting/rendering pipeline; the commands do not launch array-provider kernels. Graphics display requires a browser graphics host or a desktop graphics host.
Control arguments must already be host values. Unsupported resident controls reject without provider downloads; existing resident plot buffers stay owned by their plotting/rendering paths. Invalid syntax and excess output requests are checked before creating or changing graphics state.
Examples
Turn the axes frame on for a chart
plot(1:5, [1 4 2 5 3]);
box on;Style subplots independently
ax1 = subplot(1,2,1); plot(1:5,1:5); box off;
ax2 = 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
2D Charts
area · bar · errorbar · heatmap · hist · histogram · loglog · pie · plot · scatter · semilogx · semilogy · stairs · stem
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
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.