Giter Site home page Giter Site logo

plotpystack / pythonqwt Goto Github PK

View Code? Open in Web Editor NEW
84.0 14.0 24.0 6.91 MB

Qt plotting widgets for Python (pure Python reimplementation of Qwt C++ library)

Home Page: https://pypi.org/project/PythonQwt/

License: Other

Python 98.34% Batchfile 1.66%

pythonqwt's People

Contributors

ceavirginie avatar dependabot[bot] avatar mindw avatar petebachant avatar pierreraybaut avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pythonqwt's Issues

TypeError: 'PySide2.QtCore.QRect' object is not subscriptable

Hi,

I'm using setStyleSheet in my PySide2 application. If I add a QwtPlot I get the following exception:

Traceback (most recent call last):
  File "C:\Users\user\project\venv\lib\site-packages\qwt\null_paintdevice.py", line 54, in drawRects
    device.drawRects(rects, rectCount)
  File "C:\Users\user\project\venv\lib\site-packages\qwt\plot_canvas.py", line 75, in drawRects
    self.border.rectList += [rects[i]]
TypeError: 'PySide2.QtCore.QRect' object is not subscriptable
Traceback (most recent call last):
  File "C:\Users\user\project\venv\lib\site-packages\qwt\null_paintdevice.py", line 54, in drawRects
    device.drawRects(rects, rectCount)
  File "C:\Users\user\project\venv\lib\site-packages\qwt\plot_canvas.py", line 75, in drawRects
    self.border.rectList += [rects[i]]
TypeError: 'PySide2.QtCore.QRect' object is not subscriptable
Traceback (most recent call last):
  File "C:\Users\user\project\venv\lib\site-packages\qwt\null_paintdevice.py", line 54, in drawRects
    device.drawRects(rects, rectCount)
  File "C:\Users\user\project\venv\lib\site-packages\qwt\plot_canvas.py", line 75, in drawRects
    self.border.rectList += [rects[i]]
TypeError: 'PySide2.QtCore.QRect' object is not subscriptable
Traceback (most recent call last):
  File "C:\Users\user\project\venv\lib\site-packages\qwt\null_paintdevice.py", line 54, in drawRects
    device.drawRects(rects, rectCount)
  File "C:\Users\user\project\venv\lib\site-packages\qwt\plot_canvas.py", line 75, in drawRects
    self.border.rectList += [rects[i]]
TypeError: 'PySide2.QtCore.QRect' object is not subscriptable
Traceback (most recent call last):
  File "C:\Users\user\project\venv\lib\site-packages\qwt\scale_widget.py", line 406, in paintEvent
    painter.setClipRegion(event.region())
AttributeError: 'PySide2.QtCore.QRect' object has no attribute 'region'
Traceback (most recent call last):
  File "C:\Users\user\project\venv\lib\site-packages\qwt\null_paintdevice.py", line 54, in drawRects
    device.drawRects(rects, rectCount)
  File "C:\Users\user\project\venv\lib\site-packages\qwt\plot_canvas.py", line 75, in drawRects
    self.border.rectList += [rects[i]]
TypeError: 'PySide2.QtCore.QRect' object is not subscriptable

Example code to reproduce the exception

import PySide2.QtWidgets as QtWidgets
import qwt
import sys


class SimplePlot(QtWidgets.QWidget):
    def __init__(self):
        super(SimplePlot, self).__init__()

        self.layout = QtWidgets.QHBoxLayout()
        self.setLayout(self.layout)
        self.plot_widget = qwt.QwtPlot()
        self.plot_widget.setTitle("Really simple demo")
        self.layout.addWidget(self.plot_widget)

        self.setStyleSheet("background-color: red;")


if __name__ == "__main__":
    app = QtWidgets.QApplication(sys.argv)
    foo = SimplePlot()
    foo.show()

    sys.exit(app.exec_())

Add support for stacked area plots

It would be great to have an API for working with "stacked" area plots. A stacked area plot is a collection of line plots where the the values on the y axis are accumulated at each x position, and the resulting areas between lines are filled. These are useful if you, for example, want to illustrate the composition of something as a set of percentages over time.

It's currently possible to simulate a stacked area plot by preprocessing your data and doing the accumulation yourself, and use a set of QwtPlotCurve drawn on top of each other. But it would be very nice if there was a dedicated API for this (QwtPlotAreaStack, or QwtPlotStack, ...?) that could take care of those details.

I understand this is quite a big feature request, but I'm interested in what you think.

PyQt/NumPy types conflict

I: pybuild base:237: xvfb-run -a --server-args="-screen 0 1024x768x24" python3.10 -m qwt.tests.init
Traceback (most recent call last):
File "/<>/qwt/null_paintdevice.py", line 249, in metric
value = self.sizeMetrics().width()
File "/<>/qwt/graphic.py", line 386, in sizeMetrics
return QSize(np.ceil(sz.width()), np.ceil(sz.height()))
TypeError: arguments did not match any overloaded call:
QSize(): too many arguments
QSize(int, int): argument 1 has unexpected type 'numpy.float64'
QSize(QSize): argument 1 has unexpected type 'numpy.float64'
Aborted
Traceback (most recent call last):
File "/<>/qwt/null_paintdevice.py", line 249, in metric
value = self.sizeMetrics().width()
File "/<>/qwt/graphic.py", line 386, in sizeMetrics
return QSize(np.ceil(sz.width()), np.ceil(sz.height()))
TypeError: arguments did not match any overloaded call:
QSize(): too many arguments
QSize(int, int): argument 1 has unexpected type 'numpy.float64'
QSize(QSize): argument 1 has unexpected type 'numpy.float64'
Aborted
Traceback (most recent call last):
File "/<>/qwt/null_paintdevice.py", line 249, in metric
value = self.sizeMetrics().width()
File "/<>/qwt/graphic.py", line 386, in sizeMetrics
return QSize(np.ceil(sz.width()), np.ceil(sz.height()))
TypeError: arguments did not match any overloaded call:
QSize(): too many arguments
QSize(int, int): argument 1 has unexpected type 'numpy.float64'
QSize(QSize): argument 1 has unexpected type 'numpy.float64'
Aborted
Traceback (most recent call last):
File "/<>/qwt/null_paintdevice.py", line 249, in metric
value = self.sizeMetrics().width()
File "/<>/qwt/graphic.py", line 386, in sizeMetrics
return QSize(np.ceil(sz.width()), np.ceil(sz.height()))
TypeError: arguments did not match any overloaded call:
QSize(): too many arguments
QSize(int, int): argument 1 has unexpected type 'numpy.float64'
QSize(QSize): argument 1 has unexpected type 'numpy.float64'
Aborted
Traceback (most recent call last):
File "/<>/qwt/null_paintdevice.py", line 249, in metric
value = self.sizeMetrics().width()
File "/<>/qwt/graphic.py", line 386, in sizeMetrics
return QSize(np.ceil(sz.width()), np.ceil(sz.height()))
TypeError: arguments did not match any overloaded call:
QSize(): too many arguments
QSize(int, int): argument 1 has unexpected type 'numpy.float64'
QSize(QSize): argument 1 has unexpected type 'numpy.float64'
Aborted
Traceback (most recent call last):
File "/<>/qwt/tests/curvedemo1.py", line 88, in paintEvent
self.drawContents(painter)
File "/<>/qwt/tests/curvedemo1.py", line 102, in drawContents
curve.draw(painter, self.xMap, self.yMap, r)
File "/<>/qwt/plot_series.py", line 99, in draw
self.drawSeries(painter, xMap, yMap, canvasRect, 0, -1)
File "/<>/qwt/plot_curve.py", line 562, in drawSeries
self.drawCurve(
File "/<>/qwt/plot_curve.py", line 593, in drawCurve
self.drawSticks(painter, xMap, yMap, canvasRect, from_, to)
File "/<>/qwt/plot_curve.py", line 653, in drawSticks
painter.drawLine(xi, y0, xi, yi)
TypeError: arguments did not match any overloaded call:
drawLine(self, QLineF): argument 1 has unexpected type 'float'
drawLine(self, QLine): argument 1 has unexpected type 'float'
drawLine(self, int, int, int, int): argument 1 has unexpected type 'float'
drawLine(self, QPoint, QPoint): argument 1 has unexpected type 'float'
drawLine(self, Union[QPointF, QPoint], Union[QPointF, QPoint]): argument 1 has unexpected type 'float'
Aborted
Traceback (most recent call last):
File "/<>/qwt/tests/curvedemo2.py", line 85, in paintEvent
self.drawContents(painter)
File "/<>/qwt/tests/curvedemo2.py", line 92, in drawContents
curve.draw(painter, xMap, yMap, r)
File "/<>/qwt/plot_series.py", line 99, in draw
self.drawSeries(painter, xMap, yMap, canvasRect, 0, -1)
File "/<>/qwt/plot_curve.py", line 568, in drawSeries
self.drawSymbols(
File "/<>/qwt/plot_curve.py", line 837, in drawSymbols
symbol.drawSymbols(painter, points)
File "/<>/qwt/symbol.py", line 1047, in drawSymbols
self.renderSymbols(painter, points, numPoints)
File "/<>/qwt/symbol.py", line 1130, in renderSymbols
qwtDrawXCrossSymbols(painter, points, numPoints, self)
File "/<>/qwt/symbol.py", line 248, in qwtDrawXCrossSymbols
painter.drawLine(x1, y1, x2, y2)
TypeError: arguments did not match any overloaded call:
drawLine(self, QLineF): argument 1 has unexpected type 'float'
drawLine(self, QLine): argument 1 has unexpected type 'float'
drawLine(self, int, int, int, int): argument 1 has unexpected type 'float'
drawLine(self, QPoint, QPoint): argument 1 has unexpected type 'float'
drawLine(self, Union[QPointF, QPoint], Union[QPointF, QPoint]): argument 1 has unexpected type 'float'
Aborted
Traceback (most recent call last):
File "/<>/qwt/null_paintdevice.py", line 249, in metric
value = self.sizeMetrics().width()
File "/<>/qwt/graphic.py", line 386, in sizeMetrics
return QSize(np.ceil(sz.width()), np.ceil(sz.height()))
TypeError: arguments did not match any overloaded call:
QSize(): too many arguments
QSize(int, int): argument 1 has unexpected type 'numpy.float64'
QSize(QSize): argument 1 has unexpected type 'numpy.float64'
Aborted
Traceback (most recent call last):
File "/<>/qwt/null_paintdevice.py", line 249, in metric
value = self.sizeMetrics().width()
File "/<>/qwt/graphic.py", line 386, in sizeMetrics
return QSize(np.ceil(sz.width()), np.ceil(sz.height()))
TypeError: arguments did not match any overloaded call:
QSize(): too many arguments
QSize(int, int): argument 1 has unexpected type 'numpy.float64'
QSize(QSize): argument 1 has unexpected type 'numpy.float64'
Aborted
Traceback (most recent call last):
File "/<>/qwt/null_paintdevice.py", line 249, in metric
value = self.sizeMetrics().width()
File "/<>/qwt/graphic.py", line 386, in sizeMetrics
return QSize(np.ceil(sz.width()), np.ceil(sz.height()))
TypeError: arguments did not match any overloaded call:
QSize(): too many arguments
QSize(int, int): argument 1 has unexpected type 'numpy.float64'
QSize(QSize): argument 1 has unexpected type 'numpy.float64'
Aborted
Traceback (most recent call last):
File "/<>/qwt/null_paintdevice.py", line 249, in metric
value = self.sizeMetrics().width()
File "/<>/qwt/graphic.py", line 386, in sizeMetrics
return QSize(np.ceil(sz.width()), np.ceil(sz.height()))
TypeError: arguments did not match any overloaded call:
QSize(): too many arguments
QSize(int, int): argument 1 has unexpected type 'numpy.float64'
QSize(QSize): argument 1 has unexpected type 'numpy.float64'
Aborted
Traceback (most recent call last):
File "/<>/qwt/null_paintdevice.py", line 249, in metric
value = self.sizeMetrics().width()
File "/<>/qwt/graphic.py", line 386, in sizeMetrics
return QSize(np.ceil(sz.width()), np.ceil(sz.height()))
TypeError: arguments did not match any overloaded call:
QSize(): too many arguments
QSize(int, int): argument 1 has unexpected type 'numpy.float64'
QSize(QSize): argument 1 has unexpected type 'numpy.float64'
Aborted
Traceback (most recent call last):
File "/<>/qwt/null_paintdevice.py", line 249, in metric
value = self.sizeMetrics().width()
File "/<>/qwt/graphic.py", line 386, in sizeMetrics
return QSize(np.ceil(sz.width()), np.ceil(sz.height()))
TypeError: arguments did not match any overloaded call:
QSize(): too many arguments
QSize(int, int): argument 1 has unexpected type 'numpy.float64'
QSize(QSize): argument 1 has unexpected type 'numpy.float64'
Aborted
Traceback (most recent call last):
File "/<>/qwt/null_paintdevice.py", line 249, in metric
value = self.sizeMetrics().width()
File "/<>/qwt/graphic.py", line 386, in sizeMetrics
return QSize(np.ceil(sz.width()), np.ceil(sz.height()))
TypeError: arguments did not match any overloaded call:
QSize(): too many arguments
QSize(int, int): argument 1 has unexpected type 'numpy.float64'
QSize(QSize): argument 1 has unexpected type 'numpy.float64'
Aborted
Traceback (most recent call last):
File "/<>/qwt/null_paintdevice.py", line 249, in metric
value = self.sizeMetrics().width()
File "/<>/qwt/graphic.py", line 386, in sizeMetrics
return QSize(np.ceil(sz.width()), np.ceil(sz.height()))
TypeError: arguments did not match any overloaded call:
QSize(): too many arguments
QSize(int, int): argument 1 has unexpected type 'numpy.float64'
QSize(QSize): argument 1 has unexpected type 'numpy.float64'
Aborted
Traceback (most recent call last):
File "/<>/qwt/null_paintdevice.py", line 249, in metric
value = self.sizeMetrics().width()
File "/<>/qwt/graphic.py", line 386, in sizeMetrics
return QSize(np.ceil(sz.width()), np.ceil(sz.height()))
TypeError: arguments did not match any overloaded call:
QSize(): too many arguments
QSize(int, int): argument 1 has unexpected type 'numpy.float64'
QSize(QSize): argument 1 has unexpected type 'numpy.float64'
Aborted
Traceback (most recent call last):
File "/<>/qwt/null_paintdevice.py", line 249, in metric
value = self.sizeMetrics().width()
File "/<>/qwt/graphic.py", line 386, in sizeMetrics
return QSize(np.ceil(sz.width()), np.ceil(sz.height()))
TypeError: arguments did not match any overloaded call:
QSize(): too many arguments
QSize(int, int): argument 1 has unexpected type 'numpy.float64'
QSize(QSize): argument 1 has unexpected type 'numpy.float64'
Aborted

X-axis scale wrong when plotting "vertically" (e.g. `x = sin(y)`)

Hi,

This is probably due to a misunderstanding on my part, but with the test plot:

from os import environ
from sys import argv, exit

from numpy import linspace, sin, pi
from PyQt5.QtWidgets import QApplication

environ['QT_API'] = 'pyqt5'

from qwt import QwtPlot, QwtPlotCurve


class TestPlot(QwtPlot):

    def __init__(self, parent=None):
        super(TestPlot, self).__init__("Test Plot", parent)

        self.enableAxis(self.xBottom, False)
        self.enableAxis(self.xTop, True)

        self.curve = QwtPlotCurve('Test Curve')
        self.curve.attach(self)

        y = linspace(0, 2*pi, 500)

        self.curve.setData(sin(y), y)

        self.replot()


if __name__ == '__main__':
    app = QApplication(argv)

    plot = TestPlot()
    plot.resize(300, 1000)
    plot.show()

    exit(app.exec_())

I get the output:

testplot

Notice how the scale on the top X axis is wrong (0-1000, should be 0-1).

Is this a bug? Or what is the correct way of making "vertical" plots like this?

Incorrect argument type during fillPixmap for StyledBackground

For PyQt5 (not using PySide)
fillPixmap uses a QRect object as an argument to painter.setClipRegion for the StyledBackground case but it should be a QRegion object (line 392).
if widget.testAttribute(Qt.WA_StyledBackground): painter.setClipRegion(rect)
which can be fixed by importing QRegion from QtGUI and then creating that object inline.
if widget.testAttribute(Qt.WA_StyledBackground): painter.setClipRegion(QRegion(rect))

Tick drawing artifact when setting all plot margins to 0

I'm working with the left and top axes enabled. The look I'm getting is:

example

How can I make the Y axis positioned at X = 0, and the X axis at Y = 0, so that they meet precisely at the origin? E.g. I'd like the axes to look roughly like this:

ex

Inverting the Y axis?

How can I invert the Y axis of a QwtPlot? I have a plot like this:

almost

But I would like the Y scale to go from 0 at the top to 1000 at the bottom, since it represents the depth of a bore hole. Must I manually construct a QwtScaleDiv and set the axis scale div?

setup.py indicates the wrong license

Please fix the license information given in the setup method: the current implementation states being the LGPL - but in fact the "python-qwt" module has some sort of combination between MIT and Qwt license.

PS: you are closing issues too early, what makes it impossible for me to respond ( f.e to piccas questions ).

python3-pyqt4 dependency should not be installed if python3-pyqt5 is available

When installing python3-qwt from Debian stretch (using apt-get install), python3-pyqt4 is also installed, even if python3-pyqt5 is available.

After testing python3-qwt with python3-pyqt5 and a dummy package of python3-pyqt4 (allowing to bypass the dependency on it), the impression is that python3-qwt is working well with python3-pyqt5.

The dependency on python3-pyqt4 should be made optional. If python3-pyqt5 is already installed, python3-pyqt4 should not be installed.

Funcionality for plotting dates or timeseries?

First of all thanks for making this library.

Is it somehow possible to make line plots where the x-coordinates are Python datetime objects or Numpy datetime64 elements?

I couldn't find anything in the documentation or source. I'm not familiar with Qwt but it seems to have a QwtDate class. However this is apparently not ported to PythonQwt.

Any help would be appreciated.

transform.py apparently tries to divide per zero

with no apparent success:

D:\result_tests\winpython-2.7.10.3_build3.amd64\python-2.7.10.amd64\lib\site-packages\qwt\transform.py:184: RuntimeWarning: divide by zero encountered in log
  return np.log(value)

SystemError: Bad call flags in PyCFunction_Call. METH_OLDARGS is no longer supported!

While testing our application with the new python-qwt I got this error message under python3.

It works with python2

the version are

picca@sixs7:/sida/sida/sixs$ dpkg -l | grep qwt
ii python-guiqwt 3.0.0
b5-1exp1 amd64 efficient 2D data-plotting library - Python 2
ii python-guiqwt-doc 3.0.0
b5-1exp1 all efficient 2D data-plotting library - Documentation
ii python-qwt 0.2.1-1 all Pure Python implementation of Qwt - Python 2
ii python-qwt-doc 0.2.1-1 all Pure Python implementation of Qwt - Documentation
ii python3-guiqwt 3.0.0
b5-1~exp1 amd64 efficient 2D data-plotting library - Python 3
ii python3-qwt 0.2.1-1 all Pure Python implementation of Qwt - Python 3

Traceback (most recent call last):
File "fitnxs.py", line 1372, in
main()
File "fitnxs.py", line 1367, in main
ui.setupUi(MainWindow)
File "fitnxs.py", line 1002, in setupUi
self.makewindow()
File "fitnxs.py", line 1252, in makewindow
ylabel="ylabel"))
File "/usr/lib/python3/dist-packages/guiqwt/plot.py", line 866, in init
panels=panels)
File "/usr/lib/python3/dist-packages/guiqwt/plot.py", line 781, in init
self.create_plot(options)
File "/usr/lib/python3/dist-packages/guiqwt/plot.py", line 832, in create_plot
self.plot_widget = BaseCurveWidget(self, **options)
File "/usr/lib/python3/dist-packages/guiqwt/plot.py", line 727, in init
section=section, gridparam=gridparam)
File "/usr/lib/python3/dist-packages/guiqwt/curve.py", line 1339, in init
super(CurvePlot, self).init(parent, section)
File "/usr/lib/python3/dist-packages/guiqwt/baseplot.py", line 163, in init
super(BasePlot, self).init(parent)
File "/usr/lib/python3/dist-packages/qwt/plot.py", line 318, in init
self.initAxesData()
File "/usr/lib/python3/dist-packages/qwt/plot.py", line 378, in initAxesData
d.scaleWidget.setTransformation(d.scaleEngine.transformation())
File "/usr/lib/python3/dist-packages/qwt/scale_widget.py", line 711, in setTransformation
self.layoutScale()
File "/usr/lib/python3/dist-packages/qwt/scale_widget.py", line 457, in layoutScale
bd0, bd1 = self.getBorderDistHint()
File "/usr/lib/python3/dist-packages/qwt/scale_widget.py", line 643, in getBorderDistHint
start, end = self.__data.scaleDraw.getBorderDistHint(self.font())
File "/usr/lib/python3/dist-packages/qwt/scale_draw.py", line 577, in getBorderDistHint
s = -self.labelRect(font, minTick).top()
File "/usr/lib/python3/dist-packages/qwt/scale_draw.py", line 1037, in labelRect
lbl = self.tickLabel(font, value)
File "/usr/lib/python3/dist-packages/qwt/scale_draw.py", line 420, in tickLabel
lbl.textSize(font)
File "/usr/lib/python3/dist-packages/qwt/text.py", line 529, in textSize
) = self.__data.textEngine.textMargins(font)
File "/usr/lib/python3/dist-packages/qwt/text_engine.py", line 264, in textMargins
top = fm.ascent() - self.effectiveAscent(font)
File "/usr/lib/python3/dist-packages/qwt/text_engine.py", line 223, in effectiveAscent
return ASCENTCACHE.setdefault(fontKey, self.findAscent(font))
File "/usr/lib/python3/dist-packages/qwt/text_engine.py", line 243, in findAscent
line = img.scanLine(row).asstring(linebytes)
SystemError: Bad call flags in PyCFunction_Call. METH_OLDARGS is no longer supported!

Bug Fix

In QwtPainterClass.fillPixmap()

replace
painter.setClipRegion(rect)
with
painter.setClipRegion(QRegion(rect))

Baseline not respected when plot has brush set

I'm drawing a test curve with:

        y = linspace(1000, 0, 500)
        x = 0.5 + 0.5 * sin(y/50)

        self.curve = QwtPlotCurve('Test Curve')
        self.curve.setData(x, y)
        self.curve.setXAxis(QwtPlot.xTop)
        self.curve.setRenderHint(QwtPlotItem.RenderAntialiased)
        self.curve.setBrush(QBrush(Qt.blue))
        self.curve.attach(self)

And the result is:

baseline

Since the default baseline for a plot is 0.0, I would expect the area between the curve and the Y (X = 0) axis to be filled. Am I misunderstanding? I tried setting the baseline to 0 explicitly as well, but the result was the same.

ERROR

app = qwt.qt.QtGui.QApplication([])
AttributeError: module 'qwt' has no attribute 'qt'

PlotCanvas:QwtStyleSheetRecorder rectList operations throw exceptions

For PyQt5 (not using PySide)
rectList is declared as a list in the constructor of Border but attempts to call the undefined isEmpty method on it are made in several places.
self.rectList = []
not recorder.border.rectList.isEmpty()
can be fixed by simply removing the .isEmpty() call as an empty list evaluates as True.
not recorder.border.rectList

An append operation is also attempted with the += operator with rects[i] as the argument which evaluates to a QRect object which cannot be used (the += operator requires an iterable object).
self.border.rectList += rects[i]
can be fixed by making it a normal append call
self.border.rectList.append(rects[i])

Another error is generated when trying to create a QRectF and passing a QSize (__size) as the 2nd argument instead of a QSizeF
rect = QRectF(QPointF(0., 0.), self.__size)
can be fixed with
rect = QRectF(QPointF(0., 0.), QSizeF(self.__size))

Add Qt Designer widgets

I realize this is a new project so don't take this as a strong demand, but the old PyQwt Designer widgets pyqtdesignerplugins were great. Now that PyQwt seems sort of dead, it would be great to have these again for your Python version.

Bug Fix

In QwtStyleSheetRecorder.drawRects()
Replace
self.border.rectList += rects[i]
with
self.border.rectList.append(rects[i])

or with
self.border.rectList += [rects[i]]

Several vertical plots side-by-side on the same scale?

I'm in the process of trying to achive a series of side-by-side plots like this:

hole_plots

The plots show results from the analysis of a drill core. The scale on the left is the depth down the drilled hole, and it should always be visible. The user should then be able to add and remove plots (showing e.g. element concentrations, rock density, ...) alongside this scale. In the sketch above I've shown two plots added, the first has two plot items, the second has one plot item.

My question is how to best accomplish this with PythonQwt?

My idea is to use a lone QwtScaleWidget for the scale, put it as the first item in a QHBoxLayout, and then each of the QwtPlot widgets in the same QHBoxLayout. But when using a "detached" QwtScaleWidget like this, how can I make sure that the QwtPlot widgets I put alongside it really line up with the scale properly? The positioning must be perfect, since the whole point is that the user can look at different results along the analysed core and compare them.

I'll also need to allow "zooming" and scrolling. I plan on implementing the zooming by simply adjusting the plot axis scale of all the plots simultaneously when the zoom is changed, and scrolling with a QScrollBar where I attach the scroll bar's rangeChanged signal to a slot that update the plot axis scale of all the plots. Do you see any immediate drawbacks to this approach?

license copyright for the python translation ?

Hello Pierre,

Indeed you put Uwe in the copyright BUT you forget to put yourself or the CEA, I do not know excalty how the job was done. but someone did the python translation code and own the copyright for this work

I also saw that in the MIT license headers you refere to spyderlib/init which is not part of the sources.

another minor issue, is the reference to qwt/License in the Qwt header snipset

to my opinion the top level LICENSe file is enought and avoid other spyderlib, qwt etc.. LICENSe files.
this way it is a lot easyer to do cut and past from one project to the other :)

thanks

Frederic

error in the scripts part

creating build/scripts-2.7
error: file '/home/picca/Debian/python-qwt/python-qwt/scripts/python-tests' does not exist
E: pybuild pybuild:262: build: plugin distutils failed with: exit code=1: /usr/bin/python setup.py build

indeed tsetup.py comtain python-tests instead of python-qwt-tests

Add support for bar charts

It would be great if PythonQwt had support for bar charts.

Is it in general planned to port/implement more of the plot items that Qwt offers?

plot_curve failure with PythonQwt 0.8

I've been using your python qwt code to get a pure python version of qwt. Unfortunately, something seems to have gone astray in pythonQwt 0.8 I'm attaching two plots
good_display
bad_display
The first plot shows a canvas where I'm plotting 16 channels of simulated radio astronomy data as a function of time using pythonQwt0.5, The data shows the output from 16 antennas of a radio astronomy telescope array. The data appears as I expect it to look. The second plot shows the output when I switch to using PythonQwt 0.8. As you can see, garbage appears. I'm not sure exactly where things are going wrong but I suspect the culprit is in the function array2d_to_qpolygonf which seems quite expanded from the equivalent work done entirely in the series_to_polyline function in PythonQwt 0.5

huge performance decreese between 0.4.0 and 0.5.0

0.4.0

Curve benchmark example:

Click on each tab to test if plotting performance is acceptable in terms of GUI response time (switch between tabs, resize main windows, ...).

Benchmarks results:

100 points:
Elapsed time: 530 ms

1000 points:
Elapsed time: 473 ms

10000 points:
Elapsed time: 399 ms

100000 points:
Elapsed time: 638 ms

1000000 points:
Elapsed time: 2090 ms

Total elapsed time: 4238 ms

0.5.0

Curve benchmark example:
(base plotting library: PythonQwt)

Click on each tab to test if plotting performance is acceptable in terms of GUI response time (switch between tabs, resize main windows, ...).

Benchmarks results:

100 points:
Elapsed time: 649 ms

1000 points:
Elapsed time: 530 ms

10000 points:
Elapsed time: 662 ms

100000 points:
Elapsed time: 2383 ms

1000000 points:
Elapsed time: 18440 ms

Total elapsed time: 22683 ms

please add the long description in the setup.py

Hello, on Debian/Ubuntu/... we are using the setup.py informations in order to automatically generate the packaging.
The software use for this is python-stdeb
For now the long description is missing.
It would be nice if you could set the long description for us.

It seems also that the license is not catched also
the current PKG-INFO contain a bunch of UNKNOWN fieslds

Metadata-Version: 1.1
Name: qwt
Version: 6.1.2a3
Summary: qwt is a pure Python implementation of Qwt C++ library, using PyQt and NumPy
Home-page: UNKNOWN
Author: Pierre Raybaut
Author-email: [email protected]
License: UNKNOWN
Description: UNKNOWN
Platform: UNKNOWN
Classifier: Topic :: Scientific/Engineering
Classifier: Development Status :: 3 - Alpha
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: OS Independent
Classifier: Operating System :: POSIX
Classifier: Operating System :: Unix
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Requires: PyQt4 (>4.3)

The Requieres fields seems to be inconsistant with the one from the README
PyQT4 (>= 4.4) or PyQt5 (>= 5.5)

Cheers

fix the license and copyright !

Translating the Qwt C++ code into python 1:1 doesn't allow you to change the license - the Qwt license of the original code is still very valid and any user of your python translation has to obtain its rules !

More serious the copyright: the Qwt code is my intellectual property and you can't claim being the author + having the copyright for doing a translation. This is completely unacceptable.

Please fix copyright and license of your project now !

Uwe

PS: please don't use the name Qwt for your project: this is not the Qwt project !

Bad call flags in PyCFunction_Call

When trying to execute qwt tests on python3 I get a SystemError Exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/qwt/tests/BodeDemo.py", line 298, in <module>
    demo = make()
  File "/usr/local/lib/python3.4/dist-packages/qwt/tests/BodeDemo.py", line 285, in make
    demo = BodeDemo()
  File "/usr/local/lib/python3.4/dist-packages/qwt/tests/BodeDemo.py", line 205, in __init__
    self.plot = BodePlot(self)
  File "/usr/local/lib/python3.4/dist-packages/qwt/tests/BodeDemo.py", line 77, in __init__
    QwtPlot.__init__(self, *args)
  File "/usr/local/lib/python3.4/dist-packages/qwt/plot.py", line 335, in __init__
    self.initAxesData()
  File "/usr/local/lib/python3.4/dist-packages/qwt/plot.py", line 395, in initAxesData
    d.scaleWidget.setTransformation(d.scaleEngine.transformation())
  File "/usr/local/lib/python3.4/dist-packages/qwt/scale_widget.py", line 724, in setTransformation
    self.layoutScale()
  File "/usr/local/lib/python3.4/dist-packages/qwt/scale_widget.py", line 470, in layoutScale
    bd0, bd1 = self.getBorderDistHint()
  File "/usr/local/lib/python3.4/dist-packages/qwt/scale_widget.py", line 656, in getBorderDistHint
    start, end = self.__data.scaleDraw.getBorderDistHint(self.font())
  File "/usr/local/lib/python3.4/dist-packages/qwt/scale_draw.py", line 577, in getBorderDistHint
    s = -self.labelRect(font, minTick).top()
  File "/usr/local/lib/python3.4/dist-packages/qwt/scale_draw.py", line 999, in labelRect
    lbl = self.tickLabel(font, value)
  File "/usr/local/lib/python3.4/dist-packages/qwt/scale_draw.py", line 419, in tickLabel
    lbl.textSize(font)
  File "/usr/local/lib/python3.4/dist-packages/qwt/text.py", line 937, in textSize
    ) = self.__data.textEngine.textMargins(font)
  File "/usr/local/lib/python3.4/dist-packages/qwt/text.py", line 302, in textMargins
    top = fm.ascent() - self.effectiveAscent(font)
  File "/usr/local/lib/python3.4/dist-packages/qwt/text.py", line 261, in effectiveAscent
    return ASCENTCACHE.setdefault(fontKey, self.findAscent(font))
  File "/usr/local/lib/python3.4/dist-packages/qwt/text.py", line 281, in findAscent
    line = img.scanLine(row).asstring(linebytes)
SystemError: Bad call flags in PyCFunction_Call. METH_OLDARGS is no longer supported!

My installed versions:
Python '3.4.3 (default, Oct 14 2015, 20:28:29) \n[GCC 4.8.4]'
numpy 1.8.2
qwt 0.5.5
PyQt4 4.8.6 (* This is the one loaded by guidata)
PyQt5 5.2.1
Cython 0.20.1post0
guidata 1.7.5
guiqwt 3.0.2

Bug Fix

In QwtPlotCanvas.updateStylesheetInfo()

replace
self.__data.styleSheet.hasBorder = not recorder.border.rectList.isEmpty()
with
self.__data.styleSheet.hasBorder = len(recorder.border.rectList) > 0

and

if not recorder.border.rectList.isEmpty():

with
if len(recorder.border.rectList) > 0:

Bug Fix

In painter.py

import QRectF and use in QwtPainterClass.drawBackground()

use
opt.rect = QRectF(rect).toAlignedRect()
instead of
opt.rect = rect.toAlignedRect()

Bugfixe : QSize + QSizeF

Don't know if there's more of that, but in symbol.py on the boundingRect function, the rect size is set with adding the self.__data.size to a QSizeF leading to a TypeError: unsupported operand type(s) for +: 'QSize' and 'QSizeF'.

Fix license and copyright [ part 2 ]

Hi Pierre,

a)
I can see, that you have corrected the license information, but you still have not added the copyright information. It has to be done in a similar way as you did it with the copyright in your files. The missing information has to be: "Copyright (C) 2002 Uwe Rathmann".

b) The files README and LICENSE are lacking the copyright information as well
c) The wrong information of setup.py needs to be fixed.
d) I didn't check all of the code - please do it carefully, when there is more time.

e)
I still expect, that you do release another alpha version with a correct license/copyright a.s.a.p. Packages on 3rd party pages like https://ftp-master.debian.org/new/python-qwt_6.1.2~a3-1~exp1.html have to disappear !

Please contact the debian maintainer and take care, that license and copyright information gets fixed in the meta information of the package too.

( I'm not sure if having 2 different licenses for the same package is supported by distributors like debian. If not you have to find a way how to express that the intersection between both licenses is the relevant information for the user. It might be easier to have only one license but keeping different copyrights - but of course this is up to you to decide. )

f)
Concerning guiqwt: this project gets linked against code that is published under the Qwt license and of course you have to respect all its paragraphs for this use case. This is not different to what you have to obtain, when linking against the C++ version.

When believing in "there is absolutely no license propagation or whatsover" please make yourself clear that you are wrong and better double check not doing things incorrect there too.

ciao,
Uwe

Unhashable type QFont for `BodeDemo.py` example

Under python 3.4 / Qt4, I get this error.

  File "basedir34\build\winpython-3.4.3.amd64\python-3.4.3.amd64\lib\site-package\qwt\text_engine.py", line 70, in fontmetrics
    fm = self._fm_cache.get(font)
TypeError: unhashable type: 'QFont'

Bug Fix

In qwtFillBackground()
replace
rect = fillRect.toAlignedRect()
with
rect = QRectF(fillRect).toAlignedRect()

licence [take 3]

Hello Pierre,

I need to do the license review for Debian and I can not find the license information of the
toqimage.py file. It seems to be a common snipset used on internet but I have no idea of the license.

also on thaht I have the examples, I need also the license.

Once done, I think that it will be ok from my point of view and ready to upload into Debian experimental.

thanks

Add support for geometry based axis auto-scaling

I'm currently using auto-scaling for my X-axis, but I noticed that I'm still prevented from making the plot smaller beyond a certain point. It would be great if the axis auto-scaling feature could work such that the axis division is recalculated based on the new size when the geometry of the widget changed, not just when replot โ†’ updateAxes is called. This would allow a dynamic behavior where the division of the axis scale is coarser when the plot is narrow, and finer when it is wide.

Bug Fix

QwtPlotCanvas.borderPath()

replace

if recorder.border.rectList.isEmpty():
with
if len(recorder.border.rectList) > 0:

The DataDemo.py test program crashes

The np.concatinate function calls in lines 80 and 85 fail because the axis indicator is set to 1 instead of 0. Just delete the final '1' parameter and things work.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.