Skip to content

Commit 80dc75a

Browse files
committed
MAINT renamed sublabel_filtering to label_pruning
1 parent 8f53696 commit 80dc75a

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

lib/matplotlib/scale.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ def set_default_locators_and_formatters(self, axis):
252252
axis.set_minor_formatter(
253253
LogFormatterSciNotation(self.base,
254254
labelOnlyBase=self.subs,
255-
sublabel_filtering=True))
255+
label_pruning=True))
256256

257257
def get_transform(self):
258258
"""

lib/matplotlib/tests/test_ticker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ def test_LogFormatter_sublabel():
243243
ax.xaxis.set_major_formatter(mticker.LogFormatter(labelOnlyBase=True))
244244
ax.xaxis.set_minor_formatter(mticker.LogFormatter(
245245
labelOnlyBase=False,
246-
sublabel_filtering=True))
246+
label_pruning=True))
247247
# axis range above 3 decades, only bases are labeled
248248
ax.set_xlim(1, 1e4)
249249
fmt = ax.xaxis.get_major_formatter()

lib/matplotlib/ticker.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -801,25 +801,25 @@ class LogFormatter(Formatter):
801801
Format values for log axis.
802802
"""
803803
def __init__(self, base=10.0, labelOnlyBase=False,
804-
sublabel_filtering=False):
804+
label_pruning=False):
805805
"""
806806
`base` is used to locate the decade tick, which will be the only
807807
one to be labeled if `labelOnlyBase` is ``True``.
808808
809-
Parameter
810-
---------
809+
Parameters
810+
----------
811811
base : float, optional, default: 10.
812812
base of the logarithm.
813813
814814
labelOnlyBase : bool, optional, default: False
815-
whether to only label decades ticks.
815+
whether to only label decades ticks.
816816
817-
sublabel_filtering : bool, optional, default: False
818-
When set to True, label on a subset of ticks.
817+
label_pruning : bool, optional, default: False
818+
when set to True, label on a subset of ticks.
819819
"""
820820
self._base = base + 0.0
821821
self.labelOnlyBase = labelOnlyBase
822-
self.sublabel_filtering = sublabel_filtering
822+
self.label_pruning = label_pruning
823823
self._sublabels = [1, ]
824824

825825
def base(self, base):
@@ -895,7 +895,7 @@ def __call__(self, x, pos=None):
895895
exponent = np.round(fx) if isDecade else np.floor(fx)
896896
coeff = np.round(x / b ** exponent)
897897

898-
if self.sublabel_filtering and coeff not in self._sublabels:
898+
if self.label_pruning and coeff not in self._sublabels:
899899
return ''
900900
if not isDecade and self.labelOnlyBase:
901901
return ''
@@ -976,10 +976,10 @@ def __call__(self, x, pos=None):
976976
fx = math.log(abs(x)) / math.log(b)
977977

978978
isDecade = is_close_to_int(fx)
979-
exponent = np.round(fx) if is_decade else np.floor(fx)
979+
exponent = np.round(fx) if isDecade else np.floor(fx)
980980
coeff = np.round(abs(x) / b ** exponent)
981981

982-
if self.sublabel_filtering and coeff not in self._sublabels:
982+
if self.label_pruning and coeff not in self._sublabels:
983983
return ''
984984
if not isDecade and self.labelOnlyBase:
985985
return ''
@@ -1039,7 +1039,7 @@ def __call__(self, x, pos=None):
10391039
else:
10401040
base = '%s' % b
10411041

1042-
if self.sublabel_filtering and coeff not in self._sublabels:
1042+
if self.label_pruning and coeff not in self._sublabels:
10431043
return ''
10441044
if not is_decade and self.labelOnlyBase:
10451045
return ''

0 commit comments

Comments
 (0)