PDA

View Full Version : QwtLinearColorMap not working for a [-26, 0] range data set?



adamb924
6th January 2011, 10:48
I am trying to display a spectrogram with values ranging from -26.299 to 0 (it's the log of a normalized spectrogram). With the code below, which is more or less straight out of the spectrogram example, I only get a completely white plot. If I flip the sign of all the data (so that it's [0,26.299]) there is an accurate display (but with the colors flipped, of course).

I suppose I could just shift all the values to be positive, but I'd rather not do that if I don't have to. Is there a way to get QwtLinearColorMap to work well with this data range?

Thanks,
Adam



QwtPlotSpectrogram *spectrogram = new QwtPlotSpectrogram();

QwtLinearColorMap colorMap(Qt::white, Qt::black);
spectrogram->setColorMap(colorMap);
spectrogram->setData(*spectrogramData);

QwtDoubleRect r = spectrogramData->boundingRect();
qwtPlot->setAxisScale( QwtPlot::yLeft , 0, 5000, 1000);
qwtPlot->setAxisScale( QwtPlot::xBottom , r.left(), r.right(), 0.1);

spectrogram->attach(qwtPlot);
qwtPlot->repaint();

Uwe
11th January 2011, 06:49
What about flipping the colors of the color map too: black -> white instead of white -> black ?

Uwe

adamb924
15th January 2011, 06:07
When I do that the spectrogram just displays all black instead of all white.