@@ -1052,6 +1052,11 @@ def __call__(self):
1052
1052
# hence there is no *one* interface to call self.tick_values.
1053
1053
raise NotImplementedError ('Derived must override' )
1054
1054
1055
+ def show_tick_label (self , locs ):
1056
+ """Return boolean array on whether to show a label for the given
1057
+ locations"""
1058
+ return np .ones (loc .size , dtype = np .bool )
1059
+
1055
1060
def raise_if_exceeds (self , locs ):
1056
1061
"""raise a RuntimeError if Locator attempts to create more than
1057
1062
MAXTICKS locs"""
@@ -1658,6 +1663,17 @@ def tick_values(self, vmin, vmax):
1658
1663
else :
1659
1664
ticklocs = b ** decades
1660
1665
1666
+ return self .raise_if_exceeds (np .asarray (ticklocs ))
1667
+
1668
+ def show_tick_label (self , ticklocs ):
1669
+ b = self ._base
1670
+
1671
+ vmin , vmax = self .axis .get_view_interval ()
1672
+ vmin = math .log (vmin ) / math .log (b )
1673
+ vmax = math .log (vmax ) / math .log (b )
1674
+
1675
+ numdec = abs (vmax - vmin )
1676
+
1661
1677
if numdec > 3 :
1662
1678
sublabel = set ((1 ))
1663
1679
elif numdec > 2 :
@@ -1667,14 +1683,14 @@ def tick_values(self, vmin, vmax):
1667
1683
else :
1668
1684
sublabel = set ((1 , 2 , 4 , 7 ))
1669
1685
1670
- label = [ True ,] * np .asarray (ticklocs ) .size
1686
+ label = np .ones (ticklocs .size , dtype = np . bool )
1671
1687
for i , loc in enumerate (ticklocs ):
1672
1688
exponent = math .floor (math .log (abs (loc )) / math .log (b ))
1673
1689
coeff = loc / b ** nearest_long (exponent )
1674
1690
if nearest_long (coeff ) not in sublabel :
1675
1691
label [i ] = False
1676
1692
1677
- return self . raise_if_exceeds ( np . asarray ( ticklocs )), label
1693
+ return label
1678
1694
1679
1695
def view_limits (self , vmin , vmax ):
1680
1696
'Try to choose the view limits intelligently'
0 commit comments