Skip to content

Commit a8f9659

Browse files
committed
manage locators not deriving from LocatorBase
1 parent d568db6 commit a8f9659

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/matplotlib/axis.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -890,14 +890,20 @@ def iter_ticks(self):
890890
Iterate through all of the major and minor ticks.
891891
"""
892892
majorLocs = self.major.locator()
893-
hasLabel = self.major.locator.show_tick_label(majorLocs)
893+
try:
894+
hasLabel = self.major.locator.show_tick_label(majorLocs)
895+
except AttributeError:
896+
hasLabel = np.ones(np.asarray(majorLocs).size, dtype=np.bool)
894897
majorTicks = self.get_major_ticks(len(majorLocs))
895898
self.major.formatter.set_locs(majorLocs)
896899
majorLabels = [self.major.formatter(val, i) if hasLabel[i] else ''
897900
for i, val in enumerate(majorLocs)]
898901

899902
minorLocs = self.minor.locator()
900-
hasLabel = self.major.locator.show_tick_label(minorLocs)
903+
try:
904+
hasLabel = self.major.locator.show_tick_label(minorLocs)
905+
except AttributeError:
906+
hasLabel = np.ones(np.asarray(minorLocs).size, dtype=np.bool)
901907
minorTicks = self.get_minor_ticks(len(minorLocs))
902908
self.minor.formatter.set_locs(minorLocs)
903909
minorLabels = [self.minor.formatter(val, i) if hasLabel[i] else ''

0 commit comments

Comments
 (0)