Generally speaking:
- in most cases, if you have more than one plotting command on the same axes, such as plot() or scatter() or contour(), then unless you take extra steps, the later commands will clear the axes first, removing anything that had been drawn in the axes. This does not apply to commands such as title() or xlabel(). Also, there are internal calls and some forms or function calls that do not clear the axes first. The primary way of permitting multiple graphics on the same axes, is to call "hold on" for the axes after the first graphic is drawn; use "hold off" after the last graphic is drawn
- if you use subplot() and the calculated position of the axes would overlap any other axes without being exactly the same position as the original axes, then subplot() will delete the axes that is underneath. If you have reason to adjust positions of subplots, then you should consider using the newer tiledlayout()
- if imshow() detects that the axes is in the default position for the axes, and that hold is not turned on for the axes, then imshow() will delete the axes and create a new one. It does not just clear the axes -- clearing axes would retain some properties and would retain identity. imshow() is often convenient, but it is a meanace for setting up careful interfaces
- there are some graphics functions, especially in Control Systems Toolbox, that turn out to create interactive plots. Because that involves attaching behaviour to the graphics window, those plots cannot be created inside a subplot, and will delete the entire content of the figure. bode and frequency response plots are examples of these. In such a situation, you may wish to create a new figure() to put the plot inside.