@@ -837,7 +837,12 @@ class LogFormatter(Formatter):
837837 major and minor ticks; the tick locations might be set manually,
838838 or by a locator that puts ticks at integer powers of base and
839839 at intermediate locations. For this situation, disable the
840- minor_thresholds logic by using ``minor_thresholds=(np.inf, np.inf)``.
840+ minor_thresholds logic by using ``minor_thresholds=(np.inf, np.inf)``,
841+ so that all ticks will be labeled.
842+
843+ To disable labeling of minor ticks when 'labelOnlyBase' is False,
844+ use ``minor_thresholds=(0, 0)``. This is the default for the
845+ "classic" style.
841846
842847 Examples
843848 --------
@@ -848,14 +853,18 @@ class LogFormatter(Formatter):
848853 To label all minor ticks when the view limits span up to 1.5
849854 decades, use ``minor_thresholds=(1.5, 1.5)``.
850855
851-
852856 """
853857 def __init__ (self , base = 10.0 , labelOnlyBase = False ,
854- minor_thresholds = ( 1 , 0.4 ) ,
858+ minor_thresholds = None ,
855859 linthresh = None ):
856860
857861 self ._base = float (base )
858862 self .labelOnlyBase = labelOnlyBase
863+ if minor_thresholds is None :
864+ if rcParams ['_internal.classic_mode' ]:
865+ minor_thresholds = (0 , 0 )
866+ else :
867+ minor_thresholds = (1 , 0.4 )
859868 self .minor_thresholds = minor_thresholds
860869 self ._sublabels = None
861870 self ._linthresh = linthresh
@@ -896,7 +905,6 @@ def set_locs(self, locs=None):
896905 b = self ._base
897906
898907 vmin , vmax = self .axis .get_view_interval ()
899- self .d = abs (vmax - vmin )
900908
901909 # Handle symlog case:
902910 linthresh = self ._linthresh
@@ -939,6 +947,9 @@ def __call__(self, x, pos=None):
939947 """
940948 Return the format for tick val `x`.
941949 """
950+ vmin , vmax = self .axis .get_view_interval ()
951+ vmin , vmax = mtransforms .nonsingular (vmin , vmax , expander = 0.05 )
952+ d = abs (vmax - vmin )
942953 b = self ._base
943954 if x == 0.0 :
944955 return '0'
@@ -959,7 +970,7 @@ def __call__(self, x, pos=None):
959970 elif x < 1 :
960971 s = '%1.0e' % x
961972 else :
962- s = self .pprint_val (x , self . d )
973+ s = self .pprint_val (x , d )
963974 if sign == - 1 :
964975 s = '-%s' % s
965976
0 commit comments