MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / clear

Method clear

lib/matplotlib/figure.py:972–1006  ·  view source on GitHub ↗

Clear the figure. Parameters ---------- keep_observers : bool, default: False Set *keep_observers* to True if, for example, a gui widget is tracking the Axes in the figure.

(self, keep_observers=False)

Source from the content-addressed store, hash-verified

970 ax._twinned_axes.remove(ax) # Break link between any twinned Axes.
971
972 def clear(self, keep_observers=False):
973 """
974 Clear the figure.
975
976 Parameters
977 ----------
978 keep_observers : bool, default: False
979 Set *keep_observers* to True if, for example,
980 a gui widget is tracking the Axes in the figure.
981 """
982 self.suppressComposite = None
983
984 # first clear the Axes in any subfigures
985 for subfig in self.subfigs:
986 subfig.clear(keep_observers=keep_observers)
987 self.subfigs = []
988
989 for ax in tuple(self.axes): # Iterate over the copy.
990 ax.clear()
991 self.delaxes(ax) # Remove ax from self._axstack.
992
993 self.artists = []
994 self.lines = []
995 self.patches = []
996 self.texts = []
997 self.images = []
998 self.legends = []
999 self.subplotpars.reset()
1000 if not keep_observers:
1001 self._axobservers = cbook.CallbackRegistry()
1002 self._suptitle = None
1003 self._supxlabel = None
1004 self._supylabel = None
1005
1006 self.stale = True
1007
1008 # synonym for `clear`.
1009 def clf(self, keep_observers=False):

Callers 1

clfMethod · 0.95

Calls 3

delaxesMethod · 0.95
clearMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected