PDA

View Full Version : QwtPolarSpectrogram with inverted Radius



ishitha92
27th March 2017, 22:32
I need to create a PolarSpectrogram for the following scales.
Azimuth = 0 to 360 in steps of 15 degrees
Radius = 0 to 90 in steps of 10 degrees.

I use the following code to have clock-wise scaling for Azimuth.


setScale(QwtPolar::Azimuth, 360 , 0 , 30);
setScaleMaxMinor(QwtPolar::Azimuth, 2);


But the inversion does not work for Radius.


setScale(QwtPolar::Radius, 90 , 0 , 20);
setScaleMaxMinor(QwtPolar::Radius, 2);


While the default 0 to 90 works fine. (see image: I just need the 0 - 90 be 90 - 0 )

I am using a QwtMatrixRasterData to provide 216 (24 columns and 9 rows) entries for these divisions. The interval for the data is set as


setInterval( Qt::XAxis, QwtInterval( 0.0, 360.0 ) );
setInterval( Qt::YAxis, QwtInterval( 0.0,90.0 ) );


I have tried switching the interval for the data and setting ScaleDiv(1, QwtScaleDiv(90, 0)) for the plot.

I'd appreciate any help. Thanks!

Uwe
30th March 2017, 05:56
The radius is nothing that can be inverted - what is a negative radius supposed to be ?

Uwe

ishitha92
30th March 2017, 14:39
Not a negative radius, just inverted order - 90 to 0 (The center being 90 degrees) . The spectrogram is now 0 to 90 degrees elevation/radius with 0 as the center.
Switching max and min for setScale would not work.
setInterval( Qwt::Radius, 0, 90, 20) works
setInterval (Qwt::Radius, 90, 0 ,-20(or 20) ) just renders a white plot.

Uwe
30th March 2017, 17:40
The polardemo shows how to invert the radial axis. If you do the same with the spectrogram example ( f.e by changing the slot being called for one of the buttons like below ) you see - tamteramteram: nothing.
But well after changing the 10 in the formula of SpectrogramData::value to 11 you have an image that looks different, when being inverted.


void Plot::invert()
{
setScale( QwtPolar::Radius,
scaleDiv( QwtPolar::Radius )->upperBound(),
scaleDiv( QwtPolar::Radius )->lowerBound() );

replot();
}
Uwe

ishitha92
30th March 2017, 23:31
Thanks for the response.

That would essentially work only when there is no SetInterval specified for the X and Y axis.
Because, I am using QwtMatrixRasterData and not QwtRasterData, it is mandatory that I specify X and Y axis interval.

And when I do that as mentioned earlier, the value() function is not able find the value from the matrix (only in the inverted scale).

So for a scale like this


setInterval( Qt::XAxis, QwtInterval( 0.0, 360.0 ) );
setInterval( Qt::YAxis, QwtInterval( 0.0,90.0 ) );


I am setting a matrix with 216 values ( 24 azimuth columns and 9 radius rows) using setValueMatrix and the value() function finds it as long as the scale is 0 to 90 and not the other way around.

Uwe
31st March 2017, 14:31
That would essentially work only when there is no SetInterval specified for the X and Y axis.
As long as the intervals of the axes and those from the data intersect something should be displayed.
But better start your debugger and check what is going on in QwtMatrixRasterData::value().

Uwe