diff --git a/qwt/scale_engine.py b/qwt/scale_engine.py index 73c0bdf..d95d503 100644 --- a/qwt/scale_engine.py +++ b/qwt/scale_engine.py @@ -670,6 +670,8 @@ def autoScale(self, maxNumSteps, x1, x2, stepSize, relative_margin=0.0): # Apply the relative margin (fraction of the interval width) in logarithmic # space, and convert back to linear space. if relative_margin is not None: + x1 = min(max([x1, LOG_MIN]), LOG_MAX) + x2 = min(max([x2, LOG_MIN]), LOG_MAX) log_margin = math.log(x2 / x1, logBase) * relative_margin x1 /= math.pow(logBase, log_margin) x2 *= math.pow(logBase, log_margin)