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
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);
qwtPlot->repaint();
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();
To copy to clipboard, switch view to plain text mode
Bookmarks