@@ -446,33 +446,12 @@ def __init__(self, useOffset=None, useMathText=None, useLocale=None):
446
446
mpl .rcParams ['axes.formatter.offset_threshold' ]
447
447
self .set_useOffset (useOffset )
448
448
self ._usetex = mpl .rcParams ['text.usetex' ]
449
- if useMathText is None :
450
- useMathText = mpl .rcParams ['axes.formatter.use_mathtext' ]
451
- if useMathText is False :
452
- try :
453
- from matplotlib import font_manager
454
- ufont = font_manager .findfont (
455
- font_manager .FontProperties (
456
- mpl .rcParams ["font.family" ]
457
- ),
458
- fallback_to_default = False ,
459
- )
460
- except ValueError :
461
- ufont = None
462
-
463
- if ufont == str (cbook ._get_data_path ("fonts/ttf/cmr10.ttf" )):
464
- _api .warn_external (
465
- "cmr10 font should ideally be used with "
466
- "mathtext, set axes.formatter.use_mathtext to True"
467
- )
468
449
self .set_useMathText (useMathText )
469
450
self .orderOfMagnitude = 0
470
451
self .format = ''
471
452
self ._scientific = True
472
453
self ._powerlimits = mpl .rcParams ['axes.formatter.limits' ]
473
- if useLocale is None :
474
- useLocale = mpl .rcParams ['axes.formatter.use_locale' ]
475
- self ._useLocale = useLocale
454
+ self .set_useLocale (useLocale )
476
455
477
456
def get_useOffset (self ):
478
457
"""
@@ -579,6 +558,23 @@ def set_useMathText(self, val):
579
558
"""
580
559
if val is None :
581
560
self ._useMathText = mpl .rcParams ['axes.formatter.use_mathtext' ]
561
+ if self ._useMathText is False :
562
+ try :
563
+ from matplotlib import font_manager
564
+ ufont = font_manager .findfont (
565
+ font_manager .FontProperties (
566
+ mpl .rcParams ["font.family" ]
567
+ ),
568
+ fallback_to_default = False ,
569
+ )
570
+ except ValueError :
571
+ ufont = None
572
+
573
+ if ufont == str (cbook ._get_data_path ("fonts/ttf/cmr10.ttf" )):
574
+ _api .warn_external (
575
+ "cmr10 font should ideally be used with "
576
+ "mathtext, set axes.formatter.use_mathtext to True"
577
+ )
582
578
else :
583
579
self ._useMathText = val
584
580
@@ -890,8 +886,8 @@ def __init__(self, base=10.0, labelOnlyBase=False,
890
886
minor_thresholds = None ,
891
887
linthresh = None ):
892
888
893
- self ._base = float (base )
894
- self .labelOnlyBase = labelOnlyBase
889
+ self .set_base (base )
890
+ self .set_label_minor ( labelOnlyBase )
895
891
if minor_thresholds is None :
896
892
if mpl .rcParams ['_internal.classic_mode' ]:
897
893
minor_thresholds = (0 , 0 )
@@ -901,19 +897,41 @@ def __init__(self, base=10.0, labelOnlyBase=False,
901
897
self ._sublabels = None
902
898
self ._linthresh = linthresh
903
899
900
+ @_api .deprecated ("3.6" , alternative = 'set_base()' )
904
901
def base (self , base ):
905
902
"""
906
903
Change the *base* for labeling.
907
904
908
905
.. warning::
909
906
Should always match the base used for :class:`LogLocator`
910
907
"""
911
- self ._base = base
908
+ self .set_base ( base )
912
909
910
+ def set_base (self , base ):
911
+ """
912
+ Change the *base* for labeling.
913
+
914
+ .. warning::
915
+ Should always match the base used for :class:`LogLocator`
916
+ """
917
+ self ._base = float (base )
918
+
919
+ @_api .deprecated ("3.6" , alternative = 'set_label_minor()' )
913
920
def label_minor (self , labelOnlyBase ):
914
921
"""
915
922
Switch minor tick labeling on or off.
916
923
924
+ Parameters
925
+ ----------
926
+ labelOnlyBase : bool
927
+ If True, label ticks only at integer powers of base.
928
+ """
929
+ self .set_label_minor (labelOnlyBase )
930
+
931
+ def set_label_minor (self , labelOnlyBase ):
932
+ """
933
+ Switch minor tick labeling on or off.
934
+
917
935
Parameters
918
936
----------
919
937
labelOnlyBase : bool
@@ -2250,7 +2268,8 @@ def __init__(self, base=10.0, subs=(1.0,), numdecs=4, numticks=None):
2250
2268
Parameters
2251
2269
----------
2252
2270
base : float, default: 10.0
2253
- The base of the log used, so ticks are placed at ``base**n``.
2271
+ The base of the log used, so major ticks are placed at
2272
+ ``base**n``, n integer.
2254
2273
subs : None or str or sequence of float, default: (1.0,)
2255
2274
Gives the multiples of integer powers of the base at which
2256
2275
to place ticks. The default places ticks only at
@@ -2273,30 +2292,35 @@ def __init__(self, base=10.0, subs=(1.0,), numdecs=4, numticks=None):
2273
2292
numticks = 15
2274
2293
else :
2275
2294
numticks = 'auto'
2276
- self .base (base )
2277
- self .subs (subs )
2295
+ self ._base = float (base )
2296
+ self ._set_subs (subs )
2278
2297
self .numdecs = numdecs
2279
2298
self .numticks = numticks
2280
2299
2281
2300
def set_params (self , base = None , subs = None , numdecs = None , numticks = None ):
2282
2301
"""Set parameters within this locator."""
2283
2302
if base is not None :
2284
- self .base (base )
2303
+ self ._base = float (base )
2285
2304
if subs is not None :
2286
- self .subs (subs )
2305
+ self ._set_subs (subs )
2287
2306
if numdecs is not None :
2288
2307
self .numdecs = numdecs
2289
2308
if numticks is not None :
2290
2309
self .numticks = numticks
2291
2310
2292
- # FIXME: these base and subs functions are contrary to our
2293
- # usual and desired API.
2294
-
2311
+ @_api .deprecated ("3.6" , alternative = 'set_params(base=...)' )
2295
2312
def base (self , base ):
2296
2313
"""Set the log base (major tick every ``base**i``, i integer)."""
2297
2314
self ._base = float (base )
2298
2315
2316
+ @_api .deprecated ("3.6" , alternative = 'set_params(subs=...)' )
2299
2317
def subs (self , subs ):
2318
+ """
2319
+ Set the minor ticks for the log scaling every ``base**i*subs[j]``.
2320
+ """
2321
+ self ._set_subs (subs )
2322
+
2323
+ def _set_subs (self , subs ):
2300
2324
"""
2301
2325
Set the minor ticks for the log scaling every ``base**i*subs[j]``.
2302
2326
"""
0 commit comments