Clear

A plot accumulates signals, settings, pixels, styles and a possibly nested grid of subplots over its lifetime.
The clear methods take all of that, or just one slice of it, back to the defaults.
They are grouped under the clear attribute of the figure, and of any subplot.

Clear Everything

Calling the attribute itself as a method, as in plotext.figure.clear(), resets the plot to an empty state: signals, settings, pixels, styles and sizes all return to their defaults in one call.

import plotext as plt
fig = plt.figure
fig.clear()

The plotext.figure.clear.all() method does the same, the call form being a shortcut for it.

Granular Clears

Each granular method touches one slice of the plot state and leaves the rest untouched.

Note

Calling plotext.figure.clear.pixels() is equivalent to applying the default theme: both take every color on the plot back to its package default.

Cascading

Every clear method cascades through the subplots of the plot it is called on: a single plotext.figure.clear.settings() on the master figure resets the settings on the master and on every nested subplot.
The same holds at any depth: called on a subplot that holds its own subplots, the method clears that whole branch, leaving the rest of the plot untouched.
To clear a single subplot, address it first, as in plotext.figure.subplot(2, 1).clear.settings().

See also

The terminal object holds its own pair of resets, clean() and clear(), described in the terminal clearing section of its page.