@@ -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, b
10000
ase=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
@@ -2249,7 +2267,8 @@ def __init__(self, base=10.0, subs=(1.0,), numdecs=4, numticks=None):
2249
2267
Parameters
2250
2268
----------
2251
2269
base : float, default: 10.0
2252
- The base of the log used, so ticks are placed at ``base**n``.
2270
+ The base of the log used, so major ticks are placed at
2271
+ ``base**n``, n integer.
2253
2272
subs : None or str or sequence of float, default: (1.0,)
2254
2273
Gives the multiples of integer powers of the base at which
2255
2274
to place ticks. The default places ticks only at
@@ -2272,30 +2291,35 @@ def __init__(self, base=10.0, subs=(1.0,), numdecs=4, numticks=None):
2272
2291
numticks = 15
2273
2292
else :
2274
2293
numticks = 'auto'
2275
- self .base (base )
2276
- self .subs (subs )
2294
+ self ._base = float (base )
2295
+ self ._set_subs (subs )
2277
2296
self .numdecs = numdecs
2278
2297
self .numticks = numticks
2279
2298
2280
2299
def set_params (self , base = None , subs = None , numdecs = None , numticks = None ):
2281
2300
"""Set parameters within this locator."""
2282
2301
if base is not None :
2283
- self .base (base )
2302
+ self ._base = float (base )
2284
2303
if subs is not None :
2285
- self .subs (subs )
2304
+ self ._set_subs (subs )
2286
2305
if numdecs is not None :
2287
2306
self .numdecs = numdecs
2288
2307
if numticks is not None :
2289
2308
self .numticks = numticks
2290
2309
2291
- # FIXME: these base and subs functions are contrary to our
2292
- # usual and desired API.
2293
-
<
1241
/code>
2310
+ @_api .deprecated ("3.6" , alternative = 'set_params(base=...)' )
2294
2311
def base (self , base ):
2295
2312
"""Set the log base (major tick every ``base**i``, i integer)."""
2296
2313
self ._base = float (base )
2297
2314
2315
+ @_api .deprecated ("3.6" , alternative = 'set_params(subs=...)' )
2298
2316
def subs (self , subs ):
2317
+ """
2318
+ Set the minor ticks for the log scaling every ``base**i*subs[j]``.
2319
+ """
2320
+ self ._set_subs (subs )
2321
+
2322
+ def _set_subs (self , subs ):
2299
2323
"""
2300
2324
Set the minor ticks for the log scaling every ``base**i*subs[j]``.
2301
2325
"""
0 commit comments