Clear
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.
plotext.figure.clear.data(): drops the plotted data: every signal added viadraw(), the lines placed by theline()andevent()methods, and their legend entries; the color cycler resets, every color available again. Settings, pixels, styles and sizes are preserved, ready for new data on the same configured plot.plotext.figure.clear.settings(): resets the plot settings back to defaults: the title, the axis labels, the limits, the numerical ticks and their frequency, the scale, the alignments, the direction, the date support, the grid, the frame visibility, and the legend visibility, position and alignment. Signals, pixels, styles and sizes are preserved.plotext.figure.clear.size(): drops any explicitplot_size()value and resets every subplot size, so the nextplot_size()call redistributes the space proportionally. On the master, the terminal size is read again, in case the window was resized. Signals, subplots, settings, pixels, styles and the terminal own settings are preserved.plotext.figure.clear.subplots(): wipes the subplots grid configured on this plot, returning to a single panel layout. Signals, settings, pixels, styles and size are preserved.plotext.figure.clear.pixels(): resets every pixel on the plot (labels, rulers, axes, legend and the canvas itself) to the package defaults, and rewinds the color cycler. Signals, settings, styles and sizes are preserved.plotext.figure.clear.styles(): resets the line styles of the axes and of the grid lines to default. Signals, settings, pixels and sizes are preserved.
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
plotext.figure.clear.settings() on the master figure resets the settings on the master and on every nested subplot.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.