Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 874ccdd

Browse files
committed
Allow zero sized ticks
1 parent 7b79174 commit 874ccdd

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

lib/matplotlib/axis.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2020,7 +2020,10 @@ def get_tick_space(self):
20202020
# There is a heuristic here that the aspect ratio of tick text
20212021
# is no more than 3:1
20222022
size = tick.label1.get_size() * 3
2023-
return int(np.floor(length / size))
2023+
if size > 0:
2024+
return int(np.floor(length / size))
2025+
else:
2026+
return 2**31 - 1
20242027

20252028

20262029
class YAxis(Axis):
@@ -2353,4 +2356,7 @@ def get_tick_space(self):
23532356
tick = self._get_tick(True)
23542357
# Having a spacing of at least 2 just looks good.
23552358
size = tick.label1.get_size() * 2.0
2356-
return int(np.floor(length / size))
2359+
if size > 0:
2360+
return int(np.floor(length / size))
2361+
else:
2362+
return 2**31 - 1

0 commit comments

Comments
 (0)