clf

Clears the current figure.

Category: Graphics > Formatting and Annotation

Syntax

clf

Deletes all the axes and other children of the current figure.

clf reset

Also resets the figure properties to their defaults.

clf(fig)

Clears the figure fig.

Description

The figure window stays open and empty, ready for a new plot. Use cla to clear only the current axes and keep the others.

Input arguments

fig
Optional figure handle.

Example

Clearing and plotting again

h = plot(1:5);
clf
disp(isvalid(h))
plot(1:3)
Output
   0

See also

cla figure close hold