2 Attachment(s)
qwt 6.0.0 logaritmic scaling disturbes data
First of all hello, i'm new in here ;)
I use qwt 6.0.0 with qt 4.8.1 within linux (ubuntu 12.04).
I use qwt to draw real time audio signals and the corresponding power spectrum (calculated with fftw). The audio buffer is about 150ms with 44kHz sample rate. The drawing gets updated in a 100ms interval. The drawing of the power spectrum uses a user selectable logarithmic or an linear scale for both x,y-axis (see application code for y):
Code:
if( scaleLog == true ){
ui
->qwtFreqPlot
->setAxisScaleEngine
(QwtPlot::yLeft, se
);
}
else{
ui
->qwtFreqPlot
->setAxisScaleEngine
(QwtPlot::yLeft, se
);
}
Now my problem:
Qwt seams to plot random points at lower frequencies which do not exist. It only does this if logarithmic scaling of y axis is choosen, the x axis scaling seams to have no effect on this. I already analysed the data using gnuplot, to know if there is any corruption but the data is not disturbed as you can see in the attached screenshots. I alreday recognized this quit a while ago but because it is only a display bug i did not pay much attention to it. In fact i wanted to know if any one here recognized something similar. I recognized this already in earlier versions of qwt (5.x). Maybe some one could give me a hint, thanx a lot...
Attachment 8773
Attachment 8774
cheerz x
p.s. it's just a hobby software development in my freetime so it's not urgently but i want to fix this because it simply does not look good.
Re: qwt 6.0.0 logaritmic scaling disturbes data
I don't see how an effect like on the second screen shot might be related to how curve points are mapped to a polygon . So I'm pretty sure, that the reason is a bug in application code.
The reason for the bad lines in your plot might be from:
- another curve
- bad samples at the beginning/end of your curve.
The relevant code can be found in QwtPlotCurve::drawLines(). Adding some debug statements here you should be able to find out what is going wrong easily.
Uwe
Re: qwt 6.0.0 logaritmic scaling disturbes data
Quote:
The reason for the bad lines in your plot might be from:
1. another curve
2. bad samples at the beginning/end of your curve.
Thank you for your quick response, i'll give that a try on thursday...
By the way: When i use drawDots() instead of drawLines() the problem disapears - all dots are drawn correct, no artefacts appear :(
Clearly it could/must be a problem related to my application code that was the first thing i checked before posting here (maybe not intense enough). I'm sorry, for now i'm at work i don't have the code and time to test it here or later today. So i'll answer on thursday evening after i spend some more time on the problem... My hope for to post here was that someone may have had some kind of similar problems using log scale. I'll try to reproduce this in example code,
x
Re: qwt 6.0.0 logaritmic scaling disturbes data
Quote:
Originally Posted by
xam
By the way: When i use drawDots() instead of drawLines() the problem disapears - all dots are drawn correct, no artefacts appear :(
Because the bad points are above and below the visible area. In dots style those are simply clipped away, in lines style you see the connections.
Uwe
Re: qwt 6.0.0 logaritmic scaling disturbes data
Quote:
Because the bad points are above and below the visible area. In dots style those are simply clipped away, in lines style you see the connections.
This sounds comprehensible, i gonna check this later this evening when i'm home in front of the code...
Some questions which came up this morning. Looking into the docs not clearly satisfied them:
1) How to make sure that QwtPlot contains only one curve? How check attached curves count?
2) Are there any methods to clear (detach) the curves of a plot in an efficient way?
3) What would be the best way to fully clear a curve before calling setRawSamples(..) in an updating routine?
Actually i call it within an iterative update routine like this (pseudo code):
Code:
...
curve->setRawSamples(...);
curve->attach(myPlot);
myPlot->replot();
...
thanks
1 Attachment(s)
Re: qwt 6.0.0 logaritmic scaling disturbes data
Hi, i found the problem...
I'm sorry for posting it here, because it was clearly a failure/bug in my application. To point it out in detail:
It happend because of the nature of fft and the nyquist theorem. In frequence domain only half of the array is initialized by the fftw. The fftw-doc and some dusty knowledge of mine from high school gave me the hint: After looking at the data points again i realized that the disturbed points came from the last half of the array. This part of the data had informations which are rubbish due to the frequency plotting. So just plotting the relevant data did the "trick" :cool:
In fact gnu plot handles this "rubbish" different than qwt. So thanks to Uwe, you where totally right...
Quote:
bad samples at the beginning/end of your curve.
...caused the disturbed representation of the frequence spectrum.
Added after 14 minutes:
If you like to reproduce/plot the "disturbed" data using qwt, see attached file Attachment 8780
It just contains the x,y coordinates...