Skip to content
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

Different logarithmic scale behavior when compared to Qwt #94

Open
nicoddemus opened this issue Dec 27, 2024 · 1 comment
Open

Different logarithmic scale behavior when compared to Qwt #94

nicoddemus opened this issue Dec 27, 2024 · 1 comment

Comments

@nicoddemus
Copy link
Contributor

Hi folks,

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

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! 👍

@PierreRaybaut
Copy link
Collaborator

After a quick overview, still no clue.
I'll have to look further into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants