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 `XGridMinor`

, `YGridMinor`

, and `ZGridMinor`

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.

**See Also**

The properties of axes objects

Axes Operations for related functions

graymon | griddata |