The reference should be used in conjunction with the Qwt manual. Only the differences specific to the Python bindings are documented here.
In this chapter, is not yet implemented implies that the feature can be easily implemented if needed, is not implemented implies that the feature is not easily implemented, and is not Pythonic implies that the feature will not be implemented because it violates the Python philosophy (e.g. may use dangling pointers).
If a class is described as being is fully implemented then all non-private member functions and all public class variables have been implemented.
Undocumented classes have not yet been implemented or are still experimental.
is fully implemented, but only available when PyQt wraps Qt-3. When PyQt wraps Qt-4, replace this class with QPointF except in signals. For example, clicking in the canvas of the plot displayed by the following program:
#!/usr/bin/env python
import sys
from PyQt4 import Qt
import PyQt4.Qwt5 as Qwt
def aSlot(aQPointF):
print 'aSlot gets:', aQPointF
# aSlot()
def make():
demo = Qwt.QwtPlot()
picker = Qwt.QwtPlotPicker(Qwt.QwtPlot.xBottom,
Qwt.QwtPlot.yLeft,
Qwt.QwtPicker.PointSelection,
Qwt.QwtPlotPicker.CrossRubberBand,
Qwt.QwtPicker.AlwaysOn,
demo.canvas())
picker.connect(
picker, Qt.SIGNAL('selected(const QwtDoublePoint&)'), aSlot)
return demo
# make()
def main(args):
app = Qt.QApplication(args)
demo = make()
demo.show()
sys.exit(app.exec_())
# main()
if __name__ == '__main__':
main(sys.argv)
# Local Variables: ***
# mode: python ***
# End: ***
shows that the signal returns an object of type QPointF:
aSlot gets: <PyQt4.QtCore.QPointF object at 0x2aaaaf73be20>
is fully implemented, but only available when PyQt wraps Qt-3.
When PyQt wraps Qt-4, replace this class with QRectF except in signals: see QwtDoublePoint.
is fully implemented, but only available when PyQt wraps Qt-3.
When PyQt wraps Qt-4, replace this class with QSizeF except in signals: see QwtDoublePoint.
is fully implemented, but:
is implemented as:
plot.print_(printer, filter)
is implemented as:
plot.print_(painter, rect, filter)
is fully implemented, but:
is implemented as:
curve.setData(x, y)
where x and y can be any combination of lists, tuples and Numerical Python arrays. The data is copied to C++ data types.
is fully implemented, but:
is implemented as:
qwtText = plotPicker.trackerTextF(point)
where point is a QwtDoublePoint when PyQt wraps Qt-3 or a QPointF when PyQt wraps Qt-4.
When PyQt wraps Qt-3, replace this class with QPointArray except in signals: see QwtDoublePoint.
When PyQt has been built for Qt-4, replace this class with QPolygon except in signals: see QwtDoublePoint.
is implemented as:
scaleDiv = QwtScaleDiv(
qwtDoubleInterval, majorTicks, mediumTicks, minorTicks)
is implemented as:
scaleDiv = QwtScaleDiv(
lower, upper, majorTicks, mediumTicks, minorTicks)
is fully implemented.
PyQwt has a partial interface to the following QwtArray<T> templates:
- QwtArrayDouble for QwtArray<double>
- QwtArrayInt for QwtArray<int>
- QwtArrayQwtDoubleInterval for QwtArray<QwtDoubleInterval>
- QwtArrayQwtDoublePoint for QwtArray<QwtDoublePoint> when PyQt has been built against Qt-3 or for QwtArray<QPointF> when PyQt has been built against Qt-4.
Those classes have at least 3 constructors, taking QwtArrayDouble as an example:
- array = QwtArrayDouble()
- array = QwtArrayDouble(int)
- array = QwtArrayDouble(otherArray)
QwtArrayDouble and QwtArrayInt have also a constructor which takes a sequence of items convertable to a C++ double and a C++ long. For instance:
- array = QwtArrayDouble(numpy.array([0.0, 1.0]))
- array = QwtArrayInt(numpy.array([0, 1]))
All those classes have 16 member functions, taking QwtArrayDouble as example:
- array = array.assign(otherArray)
- item = array.at(index)
- index = array.bsearch(item)
- index = contains(item)
- array = otherArray.copy()
- result = array.count()
- array.detach()
- array = array.duplicate(otherArray)
- bool = array.fill(item, index=-1)
- index = array.find(item, index=0)
- bool = array.isEmpty()
- bool = array.isNull()
- bool = array.resize(index)
- result = array.size()
- array.sort()
- bool = array.truncate(index)
Iterators are not yet implemented. However, the implementation of the special class methods __getitem__, __len__ and __setitem__ let you use those classes almost as a sequence. For instance:
>>> from PyQt4.Qwt5 import *
>>> import numpy as np
>>> a = QwtArrayDouble(np.arange(10, 20, 4))
>>> for i in a: # thanks to __getitem__
... print i
...
10.0
14.0
18.0
>>> for i in range(len(a)): # thanks to __len__
... print a[i] # thanks to __getitem__
...
10.0
14.0
18.0
>>> for i in range(len(a)): # thanks to __len__
... a[i] = 10+3*i # thanks to __setitem__
...
>>> for i in a: # thanks to __getitem__
... print i
...
10.0
13.0
16.0
Provides a command line interpreter friendly layer over QwtPlot. An example of its use is:
>>> import numpy as np
>>> from PyQt4.Qt import *
>>> from PyQt4.Qwt5 import *
>>> from PyQt4.Qwt5.qplt import *
>>> application = QApplication([])
>>> x = np.arange(-2*np.pi, 2*np.pi, 0.01)
>>> p = Plot(
... Curve(x, np.cos(x), Pen(Magenta, 2), 'cos(x)'),
... Curve(x, np.exp(x), Pen(Red), 'exp(x)', Y2),
... Axis(Y2, Log),
... 'PyQwt using Qwt-%s -- http://qwt.sf.net' % QWT_VERSION_STR)
>>> QPixmap.grabWidget(p).save('cli-plot-1.png', 'PNG')
True
>>> x = x[0:-1:10]
>>> p.plot(
... Curve(x, np.cos(x-np.pi/4), Symbol(Circle, Yellow), 'circle'),
... Curve(x, np.cos(x+np.pi/4), Pen(Blue), Symbol(Square, Cyan), 'square'))
>>> QPixmap.grabWidget(p).save('cli-plot-2.png', 'PNG')
True
A command line interpreter friendly class.
The interpretation of the *rest parameters is type dependent:
A command line friendly layer over QwtPlotCurve.
Parameters:
The interpretation of the *rest parameters is type dependent:
A QMainWindow widget with a Plot widget as central widget. It provides:
The interpretation of the rest parameters is type dependent:
A command line friendly layer over QPen.
The interpretation of the *rest parameters is type dependent:
A command line interpreter friendly layer over QwtPlot.
The interpretation of the *rest parameters is type dependent:
Clone the plot into Grace for very high quality hard copy output.
Know bug: Grace does not scale the data correctly when Grace cannot cannot keep up with gracePlot. This happens when it takes too long to load Grace in memory (exit the Grace process and try again) or when ‘pause’ is too short.
Plot additional curves and/or axes.
The interpretation of the *rest parameters is type dependent:
A command line friendly layer over QwtSymbol.
The interpretation of the *rest parameters is type dependent: