@@ -446,33 +446,12 @@ def __init__(self, useOffset=None, useMathText=None, useLocale=None):
446446 mpl .rcParams ['axes.formatter.offset_threshold' ]
447447 self .set_useOffset (useOffset )
448448 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- )
468449 self .set_useMathText (useMathText )
469450 self .orderOfMagnitude = 0
470451 self .format = ''
471452 self ._scientific = True
472453 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 )
476455
477456 def get_useOffset (self ):
478457 """
@@ -579,6 +558,23 @@ def set_useMathText(self, val):
579558 """
580559 if val is None :
581560 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+ )
582578 else :
583579 self ._useMathText = val
584580
@@ -890,8 +886,8 @@ def __init__(self, base=10.0, labelOnlyBase=False,
890886 minor_thresholds = None ,
891887 linthresh = None ):
892888
893- self ._base = float (base )
894- self .labelOnlyBase = labelOnlyBase
889+ self .set_base (base )
890+ self .set_label_minor ( labelOnlyBase )
895891 if minor_thresholds is None :
896892 if mpl .rcParams ['_internal.classic_mode' ]:
897893 minor_thresholds = (0 , 0 )
@@ -901,19 +897,41 @@ def __init__(self, base=10.0, labelOnlyBase=False,
901897 self ._sublabels = None
902898 self ._linthresh = linthresh
903899
900+ @_api .deprecated ("3.6" , alternative = 'set_base()' )
904901 def base (self , base ):
905902 """
906903 Change the *base* for labeling.
907904
908905 .. warning::
909906 Should always match the base used for :class:`LogLocator`
910907 """
911- self ._base = base
908+ self .set_base ( base )
912909
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()' )
913920 def label_minor (self , labelOnlyBase ):
914921 """
915922 Switch minor tick labeling on or off.
916923
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+
917935 Parameters
918936 ----------
919937 labelOnlyBase : bool
@@ -2249,7 +2267,8 @@ def __init__(self, base=10.0, subs=(1.0,), numdecs=4, numticks=None):
22492267 Parameters
22502268 ----------
22512269 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.
22532272 subs : None or str or sequence of float, default: (1.0,)
22542273 Gives the multiples of integer powers of the base at which
22552274 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):
22722291 numticks = 15
22732292 else :
22742293 numticks = 'auto'
2275- self .base (base )
2276- self .subs (subs )
2294+ self ._base = float (base )
2295+ self ._set_subs (subs )
22772296 self .numdecs = numdecs
22782297 self .numticks = numticks
22792298
22802299 def set_params (self , base = None , subs = None , numdecs = None , numticks = None ):
22812300 """Set parameters within this locator."""
22822301 if base is not None :
2283- self .base (base )
2302+ self ._base = float (base )
22842303 if subs is not None :
2285- self .subs (subs )
2304+ self ._set_subs (subs )
22862305 if numdecs is not None :
22872306 self .numdecs = numdecs
22882307 if numticks is not None :
22892308 self .numticks = numticks
22902309
2291- # FIXME: these base and subs functions are contrary to our
2292- # usual and desired API.
2293-
2310+ @_api .deprecated ("3.6" , alternative = 'set_params(base=...)' )
22942311 def base (self , base ):
22952312 """Set the log base (major tick every ``base**i``, i integer)."""
22962313 self ._base = float (base )
22972314
2315+ @_api .deprecated ("3.6" , alternative = 'set_params(subs=...)' )
22982316 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 ):
22992323 """
23002324 Set the minor ticks for the log scaling every ``base**i*subs[j]``.
23012325 """
0 commit comments