MATLAB Function Reference |

Grid lines for two- and three-dimensional plots

**Syntax**

**Description**

The `grid`

function turns the current axes' grid lines on and off.

```
grid on
```

adds major grid lines to the current axes.

```
grid off
```

removes major and minor grid lines from the current axes.

```
grid
```

toggles the major grid visibility state.

```
grid(axes_handle,...)
```

uses the axes specified by `axes_handle`

instead of the current axes.

**Algorithm**

`grid`

sets the `XGrid`

, `YGrid`

, and `ZGrid`

properties of the axes.

`grid minor`

sets the `XMinorGrid`

, `YMinorGrid`

, and `ZMinorGrid`

properties of the axes.

You can set the grid lines for just one axis using the `set`

command and the individual property. For example,

turns on only *x*-axis grid lines.

Note that the grid line width is not affected by the axes `LineWidth`

property.

**See Also**

The properties of axes objects

Axes Operations for related functions

graymon | griddata |

© 1994-2005 The MathWorks, Inc.