1 Attachment(s)
QwtPlotSpectrogram and contour lines
Hi,
I am plotting some values with a QwtPlotSpectrogram:
Code:
plotImage.
fill(QColor(Qt
::white));
map.setPaintInterval(0, 1);
map.setScaleInterval(0, 1);
plotSpectogram.
draw(&painter, map, map,
QRect(QPoint(0,
0), plotSize
));
That works fine. But if if switch the ContourMode on, somehow the contour lines are mirrored vertically (see attached image). Attachment 4373
I derive QwtRasterData and implemented all the necessary functions.
This looks like the typical coordinate system problem, at which the origin of the spectrum is bottom left, but the origin of the image is top left. Since I guess, the QwtRasterData::value() method is used for both the image and the contour lines, I dont see, what I did wrong. Do I have to modify the QwtScaleMaps somehow? Or is this origin thing only considered inside QwtPlotSpectrogam while plotting the spectrogram, but not while plotting the contour lines?
I am using Qt 4.6 and Qwt 5.2.
Thanks,
Christoph
1 Attachment(s)
Re: QwtPlotSpectrogram and contour lines
I did some further research. If I attach the QwtPlotSpectrogram I use to create the image to a regular QwtPlot, it turns out fine (see attached Image).
Attachment 4384
Seems to me, that the different origins of a QwtPlot and a QPixmap (or image in general) are not taken into consideration in the method QwtPlotSpectrogram::draw().
Re: QwtPlotSpectrogram and contour lines
Better try to understand, what the maps are about !
Code:
plotImage.
fill(QColor(Qt
::white));
xMap.setPaintInterval(0, plotSize.width());
xMap.setScaleInterval(...);
yMap.setPaintInterval(plotSize.height(), 0); // inverted !!!
yMap.setScaleInterval(...);
plotSpectogram.
draw(&painter, xMap, yMap,
QRect(QPoint(0,
0), plotSize
));
Uwe
Re: QwtPlotSpectrogram and contour lines
Thanks, that solved the problem.