PlotPyStack / guiqwt

Efficient 2D plotting Python library based on PythonQwt

Home Page:https://pypi.python.org/pypi/guiqwt

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

External axes do not match internal grid

felipeespic opened this issue · comments

Hello,

I am trying to use the library, but the ticks and numbers of axes usually do not match the grid, so it is confusing to inspect data. I have attached some examples, which are part of the provided tests.

I am using:
Python 2.7.6
Qt 4.8.6
guiqwt 3.0.1
PyCharm 5.0.3

Thanks

p1
p2

Thanks for the feedback: you have discovered a bug related to PythonQwt axis management. PythonQwt is the library which guiqwt v3 relies on for curve plotting, canvas layout and especially axis drawing. As PythonQwt is quite young, this kind of bug although annoying is not so surprising.

Grid and axis ticks should indeed be aligned and that is the case in most situations. But, as you pointed out, in the following test, it's buggy:

import numpy as np
import guiqwt.pyplot as plt
x = np.linspace(-5, 5, 1000)
plt.figure("table plot")
data = np.array([x, np.sin(x), np.cos(x)]).T
plt.plot(data)
plt.show()

However, this only seems to be a rounding error when building the axis layout as you can see in this video (look a the X-axis which is sometimes aligned with the grid and is slowly getting misaligned):
https://youtu.be/JnX50HHhkN4

I'll take a look as soon as I can.

In the meantime, if you want to test it further, do not hesitate to report any other unexpected behavior. As an alternative, please keep in mind that guiqwt v2 (which relies on guidata v1.6 and PyQwt 5) is still available and very similar in terms of features. The main difference between guiqwt v2 and v3 is the fact that PyQwt was replaced by PythonQwt: it may cause some troubles (like this issue) at the beginning but it is a wiser choice for the future (PyQwt is deprecated).

As you may notice in the automatic notification just above, I've opened an issue in PythonQwt to fix this problem as soon as possible (I've been able to reproduce it with an example from PythonQwt, so I can confirm that it is not a pure guiqwt isssue).

Will be fixed in next release of PythonQwt: see PlotPyStack/PythonQwt#30.

To make this bug disappear, just upgrade PythonQwt to v0.5.4. Note that guiqwt itself does not need to be upgraded.

Hi Pierre,

Thank you very much for your quick reply and solution that you provided.

yeah, it is working perfect now!

Best