Skip to content

Fix autoScale in scale_engine.py #90

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions qwt/scale_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -674,10 +674,9 @@ 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)
# 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

logRef = 1.0
Expand Down
Loading