# hold

Retain current plot when adding new plots.

## Syntax

* hold('on')
* hold('off')
* hold('all')
* hold()
* hold(ax, ...)

## Input argument

* 'on' - turn hold on.
* 'off' - turn hold off.
* 'all' - same as hold on.
* ax - Target axes: axes.

## Output argument

* ax - a graphics object: axes type.

## Description

hold allows to construct a plot sequence incrementally.

## Example

```matlab
f = figure();
x = linspace(-pi, pi);
y1 = cos(x);
plot(x, y1)
hold on
y2 = sin(x);
plot(x, y2)
hold off
```

![](https://160667757-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LdPvJ6mJve3gz5MU4d1%2Fuploads%2Fgit-blob-8233d561aeafa585de36e307c03f12473ef499ec%2Fhold_65362EBC.svg?alt=media)

## See also

[ishold](ishold), [newplot](newplot).

## History

| Version | Description     |
| ------- | --------------- |
| 1.0.0   | initial version |

## Author

Allan CORNET
