hold
Control whether new plots replace or add to existing graphs.
Syntax
Section titled “Syntax”hold onhold offhold('on')Description
Section titled “Description”hold on makes subsequent plot calls add to the current axes (preserving existing graphs). hold off (default) makes the next plot call clear the axes first. Common for overlaying multiple data series.
Examples
Section titled “Examples”plot(x, y1); hold on;plot(x, y2);hold off