Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 19a06a3

Browse filesBrowse files
committed
manage locators not deriving from LocatorBase
1 parent d568db6 commit 19a06a3
Copy full SHA for 19a06a3

File tree

Expand file treeCollapse file tree

2 files changed

+9
-3
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+9
-3
lines changed

‎lib/matplotlib/axis.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axis.py
+8-2Lines 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 ''

‎lib/matplotlib/ticker.py

Copy file name to clipboardExpand all lines: lib/matplotlib/ticker.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1625,7 +1625,7 @@ def show_tick_label(self, ticklocs):
16251625
numdec = abs(vmax - vmin)
16261626

16271627
if numdec > 3:
1628-
sublabel = set((1))
1628+
sublabel = set((1,))
16291629
elif numdec > 2:
16301630
sublabel = set((1, 3))
16311631
elif numdec > 1:

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.