[PyKDE] How to populate a QwtPlotSpectrogram
gerard.vermeulen at grenoble.cnrs.fr
Tue Oct 17 19:02:50 BST 2006
On Tue, 17 Oct 2006 18:30:22 +0200
Martin Wiechert <martin.wiechert at gmx.de> wrote:
> Hi list,
> While playing with PyQwt5 I stumbled accross QwtPlotSpectrogram which appears
> to be the official replacement for the "engineered ImagePlotDemo.py" which I
> think not only I am using to display data matrices.
> But I cannot make it work for me:
> >>> b = qwt.QwtPlotSpectrogram ()
> >>> C = qwt.QwtRasterData (c)
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> TypeError: Qwt.QwtRasterData represents a C++ abstract class and cannot be
> Docs say QwtPlotSpectrogram.setData wants a QwtRasterData object and this
> class doesn't seem to have children. What am I missing?
You have to subclass QwtRasterData in a way similar to the subclassing
of QwtData in the SimpleDemo.py example.
The only problem is that it won't work because the virtual copy constructor
in the SIP file (virtual QwtRasterData *copy() const = 0;) is missing a
/Factory/ annotation. See qwt_data.sip where it has been done correctly.
I have my doubts concerning the use of QwtRasterData for displaying matrices.
QwtRasterData seems better adapted to functions of two variables.
Of course, you can use 'double value(double x, double y) function to get
interpolated data points, but the overhead -- especiailly in Python --
will be substantial. ImagePlotDemo.py relies on Qt for scaling the image to
the right size.
More information about the PyQt