Skip to content

Commit 172706f

Browse files
committed
FIX: prevent an infinite loop
closes matplotlib#6057
1 parent e2cfb52 commit 172706f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/matplotlib/ticker.py

+4
Original file line numberDiff line numberDiff line change
@@ -1503,6 +1503,7 @@ def __init__(self, base=10.0, subs=[1.0], numdecs=4, numticks=15):
15031503
"""
15041504
self.base(base)
15051505
self.subs(subs)
1506+
# this needs to be validated > 1 with traitlets
15061507
self.numticks = numticks
15071508
self.numdecs = numdecs
15081509

@@ -1575,6 +1576,9 @@ def tick_values(self, vmin, vmax):
15751576
subs = self._subs
15761577

15771578
stride = 1
1579+
if not self.numticks > 1:
1580+
raise RuntimeError('The number of ticks must be greater than 1 '
1581+
'for LogLocator.')
15781582
while numdec / stride + 1 > self.numticks:
15791583
stride += 1
15801584

0 commit comments

Comments
 (0)