Re: QwtSpectrogram problems...
Brought to you by:
rathmann
From: Joey M. <jo...@sw...> - 2006-05-26 16:06:54
|
On May 25, 2006, at 2:22 AM, Uwe Rathmann wrote: > On Wednesday 24 May 2006 23:36, Joey Mukherjee wrote: > >> I am trying the new Qwt 5.0 snapshot ... > > Which one ? I haven't released anything. The one from CVS. >> What is the easiest/best way to plot this as a spectrogram? I tried >> modifying the example, but this plot I get looks very wrong; however, >> I was just rounding the x/y passed into value to an index into my >> array, which I guess is wrong? > > Well rounding + translating x/y into an index of your array is the =20 > easiest and > fastest implementation and should give you a reasonable result - as =20= > long as > the resolution of the canvas and your data doesn't mismatch =20 > completely. This might be an issue of my color scale issues. >> Is it possible to have a logarithmic color scale that goes over all >> the decades? When I set the limits, I never see more than two? > > I=B4m not sure that I understand, what you mean by two, but looking =20= > at the code > I would expect that it is possible. But you might have to implement =20= > a color > map, where the distribution of the colors is ~logarithmic as well: =20 > more > colors for smaller ranges. You can duplicate the problem I am having by changing the main.cpp in =20= the examples/spectrogram directory. The line is: 67c66 < plot.setAxisScale(QwtPlot::yRight, 0.0, 1.0); --- > plot.setAxisScale(QwtPlot::yRight, 1e-24, 1e-12); The color bar starts at 1e-12 and ends at 1e-13. >> going from red (max) to blue? Right now, I just have five very >> obvious breaks instead a smooth color scale. > > Guess it=B4s worth to look into the implementation of QBrush/=20 > QLinearGradient or > ask TrollTech support. > > Please let me know when you found out the answer, This code make a somewhat nicer looking color bar, but I have no idea =20= how to incorporate into Qwt. QColor myColor (startColor); double deltaHue =3D myColor.hueF () / plotRealHeight; double whichColor =3D 0.0; int startx =3D plotRealWidth+xStart+xFactor; for (int i =3D yFactor; i < yFactor+plotRealHeight; i++) { myColor.setHsvF(whichColor, 1.0, 1.0); whichColor +=3D deltaHue; _painter->setPen(myColor); _painter->drawLine(startx + 10, i, startx + 30, i); } Hope it helps! Joey |