Results 1 to 4 of 4

Thread: QwtPlotSpectrogram and contour lines

  1. #1

    Default QwtPlotSpectrogram and contour lines

    Hi,

    I am plotting some values with a QwtPlotSpectrogram:
    Qt Code:
    1. QPixmap plotImage = QPixmap(plotSize);
    2. plotImage.fill(QColor(Qt::white));
    3. QPainter painter(&plotImage);
    4. map.setPaintInterval(0, 1);
    5. map.setScaleInterval(0, 1);
    6. plotSpectogram.draw(&painter, map, map, QRect(QPoint(0, 0), plotSize));
    To copy to clipboard, switch view to plain text mode 
    That works fine. But if if switch the ContourMode on, somehow the contour lines are mirrored vertically (see attached image). contourplot.jpg
    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

  2. #2

    Default 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).
    contourplot2.png
    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().

  3. #3
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,312
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QwtPlotSpectrogram and contour lines

    Better try to understand, what the maps are about !

    Qt Code:
    1. QPixmap plotImage = QPixmap(plotSize);
    2. plotImage.fill(QColor(Qt::white));
    3. QPainter painter(&plotImage);
    4.  
    5. xMap.setPaintInterval(0, plotSize.width());
    6. xMap.setScaleInterval(...);
    7.  
    8. yMap.setPaintInterval(plotSize.height(), 0); // inverted !!!
    9. yMap.setScaleInterval(...);
    10.  
    11. plotSpectogram.draw(&painter, xMap, yMap, QRect(QPoint(0, 0), plotSize));
    To copy to clipboard, switch view to plain text mode 

    Uwe

  4. #4

    Default Re: QwtPlotSpectrogram and contour lines

    Thanks, that solved the problem.

Similar Threads

  1. Help understanding QWT Contour Plot
    By jwieland in forum Qwt
    Replies: 11
    Last Post: 7th December 2009, 06:47
  2. Replies: 9
    Last Post: 3rd December 2009, 18:19
  3. Replies: 0
    Last Post: 15th September 2009, 02:34
  4. Replies: 5
    Last Post: 8th September 2009, 13:50
  5. Irregular data and QwtPlotSpectrogram
    By seveninches in forum Qwt
    Replies: 1
    Last Post: 27th January 2008, 10:52

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.