@@ -834,8 +834,8 @@ class LogFormatter(Formatter):
834834
835835 To label all minor ticks when the view limits span up to 1.5
836836 decades, use ``minor_thresholds=(1.5, 1.5)``.
837-
838837 """
838+
839839 def __init__ (self , base = 10.0 , labelOnlyBase = False ,
840840 minor_thresholds = None ,
841841 linthresh = None ):
@@ -857,7 +857,6 @@ def base(self, base):
857857
858858 .. warning::
859859 Should always match the base used for :class:`LogLocator`
860-
861860 """
862861 self ._base = base
863862
@@ -869,7 +868,6 @@ def label_minor(self, labelOnlyBase):
869868 ----------
870869 labelOnlyBase : bool
871870 If True, label ticks only at integer powers of base.
872-
873871 """
874872 self .labelOnlyBase = labelOnlyBase
875873
@@ -878,7 +876,6 @@ def set_locs(self, locs=None):
878876 Use axis view limits to control which ticks are labeled.
879877
880878 The *locs* parameter is ignored in the present algorithm.
881-
882879 """
883880 if np .isinf (self .minor_thresholds [0 ]):
884881 self ._sublabels = None
@@ -943,9 +940,7 @@ def _num_to_string(self, x, vmin, vmax):
943940 return s
944941
945942 def __call__ (self , x , pos = None ):
946- """
947- Return the format for tick val *x*.
948- """
943+ # docstring inherited
949944 if x == 0.0 : # Symlog
950945 return '0'
951946
@@ -968,11 +963,8 @@ def __call__(self, x, pos=None):
968963 return s
969964
970965 def format_data (self , value ):
971- b = self .labelOnlyBase
972- self .labelOnlyBase = False
973- value = cbook .strip_math (self .__call__ (value ))
974- self .labelOnlyBase = b
975- return value
966+ with cbook ._setattr_cm (self , labelOnlyBase = False ):
967+ return cbook .strip_math (self .__call__ (value ))
976968
977969 def format_data_short (self , value ):
978970 # docstring inherited
@@ -1027,11 +1019,7 @@ def _non_decade_format(self, sign_string, base, fx, usetex):
10271019 return r'$\mathdefault{%s%s^{%.2f}}$' % (sign_string , base , fx )
10281020
10291021 def __call__ (self , x , pos = None ):
1030- """
1031- Return the format for tick value *x*.
1032-
1033- The position *pos* is ignored.
1034- """
1022+ # docstring inherited
10351023 usetex = mpl .rcParams ['text.usetex' ]
10361024 min_exp = mpl .rcParams ['axes.formatter.min_exponent' ]
10371025
@@ -1271,11 +1259,8 @@ def __call__(self, x, pos=None):
12711259 return r"$\mathdefault{%s}$" % s
12721260
12731261 def format_data_short (self , value ):
1274- """
1275- Return a short formatted string representation of a number.
1276- """
1277- # thresholds choosen for use scienfic notation if and only if exponent
1278- # is less or equal than -2.
1262+ # docstring inherited
1263+ # Thresholds chosen to use scientific notation iff exponent <= -2.
12791264 if value < 0.1 :
12801265 return "{:e}" .format (value )
12811266 if value < 0.9 :
0 commit comments