Different logarithmic scale behavior when compared to Qwt

Hi folks,

We are having different results when using the logarithmic scale compared with Qwt.

from PyQt5.QtWidgets import QApplication
from Qwt5 import QwtPlot, QwtPlotCurve, QwtLog10ScaleEngine


app = QApplication([])
plot = QwtPlot()
plot.setWindowTitle("Qwt")
plot.resize(800, 600)

y = [1, 500, 1000, 1500]
x = [1, 2, 3, 4]

curve = QwtPlotCurve()
curve.setData(x, y)

engine = QwtLog10ScaleEngine()
plot.setAxisScaleEngine(QwtPlot.yLeft, engine)

curve.attach(plot)
plot.show()
app.exec()

image

PythonQwt

from PyQt5.QtWidgets import QApplication
from qwt import QwtPlot, QwtPlotCurve, QwtLogScaleEngine


app = QApplication([])
plot = QwtPlot()
plot.setWindowTitle("PythonQwt")
plot.resize(800, 600)

y = [1, 500, 1000, 1500]
x = [1, 2, 3, 4]

curve = QwtPlotCurve()
curve.setData(x, y)

engine = QwtLogScaleEngine()
plot.setAxisScaleEngine(QwtPlot.yLeft, engine)

curve.attach(plot)
plot.show()
app.exec()

image


The original Qwt scale looks right, but PythonQwt is not really logarithmic... any ideas what the problem might be? I suspect it might be related to the fact that now PythonQwt uses a better overall auto range calculation to give some room on each side of each axis (which looks much better in normal situations), but this extra room might not be playing well with the old logarithmic scaling code, but this is just a hunch.

I did look at the QwtLogScaleEngine.autoScale method in comparison with the original, and everything seems well.

Any hints/suggestions would be greatly appreciated! 👍