@@ -834,8 +834,8 @@ class LogFormatter(Formatter):
834
834
835
835
To label all minor ticks when the view limits span up to 1.5
836
836
decades, use ``minor_thresholds=(1.5, 1.5)``.
837
-
838
837
"""
838
+
839
839
def __init__ (self , base = 10.0 , labelOnlyBase = False ,
840
840
minor_thresholds = None ,
841
841
linthresh = None ):
@@ -857,7 +857,6 @@ def base(self, base):
857
857
858
858
.. warning::
859
859
Should always match the base used for :class:`LogLocator`
860
-
861
860
"""
862
861
self ._base = base
863
862
@@ -869,7 +868,6 @@ def label_minor(self, labelOnlyBase):
869
868
----------
870
869
labelOnlyBase : bool
871
870
If True, label ticks only at integer powers of base.
872
-
873
871
"""
874
872
self .labelOnlyBase = labelOnlyBase
875
873
@@ -878,7 +876,6 @@ def set_locs(self, locs=None):
878
876
Use axis view limits to control which ticks are labeled.
879
877
880
878
The *locs* parameter is ignored in the present algorithm.
881
-
882
879
"""
883
880
if np .isinf (self .minor_thresholds [0 ]):
884
881
self ._sublabels = None
@@ -943,9 +940,7 @@ def _num_to_string(self, x, vmin, vmax):
943
940
return s
944
941
945
942
def __call__ (self , x , pos = None ):
946
- """
947
- Return the format for tick val *x*.
948
- """
943
+ # docstring inherited
949
944
if x == 0.0 : # Symlog
950
945
return '0'
951
946
@@ -968,11 +963,8 @@ def __call__(self, x, pos=None):
968
963
return s
969
964
970
965
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 ))
976
968
977
969
def format_data_short (self , value ):
978
970
# docstring inherited
@@ -1027,11 +1019,7 @@ def _non_decade_format(self, sign_string, base, fx, usetex):
1027
1019
return r'$\mathdefault{%s%s^{%.2f}}$' % (sign_string , base , fx )
1028
1020
1029
1021
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
1035
1023
usetex = mpl .rcParams ['text.usetex' ]
1036
1024
min_exp = mpl .rcParams ['axes.formatter.min_exponent' ]
1037
1025
@@ -1271,11 +1259,8 @@ def __call__(self, x, pos=None):
1271
1259
return r"$\mathdefault{%s}$" % s
1272
1260
1273
1261
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.
1279
1264
if value < 0.1 :
1280
1265
return "{:e}" .format (value )
1281
1266
if value < 0.9 :
0 commit comments