Skip to content

Commit c652e81

Browse files
committed
Fix logarithmic scale bounds to ensure values stay within defined limits
1 parent 0e44c89 commit c652e81

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

qwt/scale_engine.py

+2
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,8 @@ def autoScale(self, maxNumSteps, x1, x2, stepSize, relative_margin=0.0):
670670
# Apply the relative margin (fraction of the interval width) in logarithmic
671671
# space, and convert back to linear space.
672672
if relative_margin is not None:
673+
x1 = min(max([x1, LOG_MIN]), LOG_MAX)
674+
x2 = min(max([x2, LOG_MIN]), LOG_MAX)
673675
log_margin = math.log(x2 / x1, logBase) * relative_margin
674676
x1 /= math.pow(logBase, log_margin)
675677
x2 *= math.pow(logBase, log_margin)

0 commit comments

Comments
 (0)