PDA

View Full Version : qwt 5 log scale..



halberdier83
1st November 2007, 08:18
Hi,

Is there a way to implement log scaling in qwt 5.x? small code pieces will be appreciated?

Thanks,

Uwe
1st November 2007, 22:27
The bode example in the Qwt package has a logarithmic scale.

HTH,
Uwe

halberdier83
6th November 2007, 12:42
Thanks Uwe,

Is there a way set the starting point to log scale. It starts at a very small number at default. But I want to start from 0. I couldnt find a suitable function..

Thanks in advance..

Uwe
6th November 2007, 15:52
10 -> 1 -> 0.1 -> 0.01 -> ... -> 0.0: try to fill the missing steps and you will understand, why the scale doesn't start at 0.0.

The engine for logarithmic scales accepts values in the range [1.0e-100, 1.0e100]. If you really need a scale starting from 0, you can derive your own "irregular" QwtScaleEngine, where you need to add some special rules for the range fom 0.0 to the value, where the regular scale starts.

Another (much easier) option is to display a "0" as label for the first small value.

Uwe

halberdier83
8th November 2007, 22:39
10 -> 1 -> 0.1 -> 0.01 -> ... -> 0.0: try to fill the missing steps and you will understand, why the scale doesn't start at 0.0.

The engine for logarithmic scales accepts values in the range [1.0e-100, 1.0e100]. If you really need a scale starting from 0, you can derive your own "irregular" QwtScaleEngine, where you need to add some special rules for the range fom 0.0 to the value, where the regular scale starts.

Another (much easier) option is to display a "0" as label for the first small value.

Uwe

Hi Uwe,

I have a plot which ranges from 0 to 1024. I want to change the scale of the axis. 10*log0 = 0 and 10*log1024 = 30.. But the scale starts from 1*e-3 and ranges to 3. That shows most of the data at the rightest side of the plot window. it looks bad. I just want to set a beginning and finishing point to that axis.

What is the easiest way. I dont want to derive the class if i dont have to.

Thanks in advance,

Uwe
9th November 2007, 00:05
I dont want to derive the class if i dont have to.

If you want a scale that is neither linear, nor log10, you have to implement its build rules as a QwtScaleEngine.
If you think your special scale engine is of common interest, send your implementation to me.

Uwe

halberdier83
12th November 2007, 07:43
Hi Uwe,

Before i send my implementation, i want to be make sure about something. As you said, the default behaviour of logScaled plotting starts at e-100. I want to know that whether i can set a range to the axis. For example, i want to plot between 10, 100 in x-axis.

Shortly, There is a setAxisScale method of QwtPlot. can i use this method after log scaled axis? i didnt try it yet. I just thought it. what do you think?

Thanks..

Uwe
12th November 2007, 08:21
With QwtPlot::setAxisScale you assign a range and a step size for a specific axis scale. This is passed to YourScaleEngine::divideScale(...) to calculate ( align, divide) a valid scale ( min, max + tick positions ) from it.

So the answer to your question is: it depends on your implementation of YourScaleEngine::divideScale.

Uwe