Skip to content

Commit 2abf730

Browse files
committed
Avoid error when computing ticks
When the axis is so small that no tick can be drawn, an exception used to be raised
1 parent a043079 commit 2abf730

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

qwt/scale_engine.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,8 @@ def buildMajorTicks(self, interval, stepSize):
561561
:return: Calculated ticks
562562
"""
563563
numTicks = min([round(interval.width()/stepSize)+1, 10000])
564+
if np.isnan(numTicks):
565+
numTicks = 0
564566
ticks = [interval.minValue()]
565567
for i in range(1, int(numTicks-1)):
566568
ticks += [interval.minValue()+i*stepSize]

0 commit comments

Comments
 (0)