From 98e719b67d3ca687f87353bdee13923d92e29c93 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Mon, 9 Dec 2024 15:11:06 -0300 Subject: [PATCH 1/2] Fix autoScale in scale_engine.py The [original code in `qwt_scale_engine.cpp`](https://sourceforge.net/p/qwt/code/HEAD/tree/trunk/qwt/src/qwt_scale_engine.cpp#l826) was setting the `stepSize` to zero. Not sure why this was changed, perhaps by accident? --- qwt/scale_engine.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/qwt/scale_engine.py b/qwt/scale_engine.py index 7e94ed4..f0cc20b 100644 --- a/qwt/scale_engine.py +++ b/qwt/scale_engine.py @@ -674,10 +674,7 @@ def autoScale(self, maxNumSteps, x1, x2, stepSize): linearInterval = linearInterval.limited(LOG_MIN, LOG_MAX) if linearInterval.maxValue() / linearInterval.minValue() < logBase: - if stepSize < 0.0: - stepSize = -math.log(abs(stepSize), logBase) - else: - stepSize = math.log(stepSize, logBase) + stepSize = 0.0 return x1, x2, stepSize logRef = 1.0 From f55e171bb16fd7f48b22b6b3405424a7f160a1a2 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Tue, 10 Dec 2024 08:57:46 -0300 Subject: [PATCH 2/2] Update scale_engine.py --- qwt/scale_engine.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/qwt/scale_engine.py b/qwt/scale_engine.py index f0cc20b..1fcc605 100644 --- a/qwt/scale_engine.py +++ b/qwt/scale_engine.py @@ -674,6 +674,8 @@ def autoScale(self, maxNumSteps, x1, x2, stepSize): linearInterval = linearInterval.limited(LOG_MIN, LOG_MAX) if linearInterval.maxValue() / linearInterval.minValue() < logBase: + # The min / max interval is too short to be represented as a log scale. + # Set the step to 0, so that a new step is calculated and a linear scale is used. stepSize = 0.0 return x1, x2, stepSize