box

Shows or hides the outline around the current axes.

Category: Graphics > Formatting and Annotation

Syntax

box on

Draws the box.

box off

Removes it.

box

Toggles the state.

box(ax, ___)

Applies to the axes ax.

Description

The box is the outline of the plot region. With box on, the top and right edges get lines and tick marks, which is useful for figures meant for print. The state is held in the Box property of the axes.

Input arguments

ax
Optional axes handle.

Example

Turning the box on

plot(1:5)
box on
disp(get(gca, 'Box'))
Output
off

See also

axis grid axes