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

Method clear

lib/matplotlib/axis.py:891–932  ·  view source on GitHub ↗

Clear the axis. This resets axis properties to their default values: - the label - the scale - locators, formatters and ticks - major and minor grid - units - registered callbacks

(self)

Source from the content-addressed store, hash-verified

889 mpl.rcParams['axes.grid.which'] in ('both', 'minor'))
890
891 def clear(self):
892 """
893 Clear the axis.
894
895 This resets axis properties to their default values:
896
897 - the label
898 - the scale
899 - locators, formatters and ticks
900 - major and minor grid
901 - units
902 - registered callbacks
903 """
904 self.label._reset_visual_defaults()
905 # The above resets the label formatting using text rcParams,
906 # so we then update the formatting using axes rcParams
907 self.label.set_color(mpl.rcParams['axes.labelcolor'])
908 self.label.set_fontsize(mpl.rcParams['axes.labelsize'])
909 self.label.set_fontweight(mpl.rcParams['axes.labelweight'])
910 self.offsetText._reset_visual_defaults()
911 self.labelpad = mpl.rcParams['axes.labelpad']
912
913 self._init()
914
915 self._set_scale('linear')
916
917 # Clear the callback registry for this axis, or it may "leak"
918 self.callbacks = cbook.CallbackRegistry(signals=["units"])
919
920 # whether the grids are on
921 self._major_tick_kw['gridOn'] = (
922 mpl.rcParams['axes.grid'] and
923 mpl.rcParams['axes.grid.which'] in ('both', 'major'))
924 self._minor_tick_kw['gridOn'] = (
925 mpl.rcParams['axes.grid'] and
926 mpl.rcParams['axes.grid.which'] in ('both', 'minor'))
927 self.reset_ticks()
928
929 self._converter = None
930 self._converter_is_explicit = False
931 self.units = None
932 self.stale = True
933
934 def reset_ticks(self):
935 """

Callers 15

__init__Method · 0.95
_on_resizeMethod · 0.45
__init__Method · 0.45
_init_drawMethod · 0.45
_reset_major_tick_kwMethod · 0.45
_reset_minor_tick_kwMethod · 0.45
rcdefaultsFunction · 0.45
__setitem__Method · 0.45
__delitem__Method · 0.45
set_locsMethod · 0.45
_update_transformMethod · 0.45
get_patch_transformMethod · 0.45

Calls 7

_set_scaleMethod · 0.95
reset_ticksMethod · 0.95
set_fontweightMethod · 0.80
set_colorMethod · 0.45
set_fontsizeMethod · 0.45
_initMethod · 0.45

Tested by

no test coverage detected