# Thread: improve the auto scaling of axis

1. Intermediate user
Join Date
May 2011
Posts
122
Thanks
34
Platforms

## improve the auto scaling of axis

Hello,

now, i plot curve with a logarithmic X axis:

Qt Code:
`myplot->setAxisScaleEngine(QwtPlot::xBottom, new QwtLog10ScaleEngine)`
To copy to clipboard, switch view to plain text mode

the result is not very nice:

the original scale is between 1e-100 and 1, if autoscale works nice is not a problem for me but, there is a problem.
my values are between 1 and 2 and during the ploting the scale stay between 1e-100 and 1e20, So my curve is like a vertical line

=> how i can modify this? can we fix originals boundaries for this autoscaling?

2. Intermediate user
Join Date
May 2011
Posts
122
Thanks
34
Platforms

## Re: improve the auto scaling of axis

=> i have a 0 for the first value it's the problem

see you

finally i haven't already a problem:

i use this to plot my curve:
Qt Code:
`for (int z=1;z<timeNb6;z++)           {                if (Points2_OneXtwoY[z][0]<0.002)                {                }                else                {                x6 << Points2_OneXtwoY[z][0] ;                y6 << Points2_OneXtwoY[z][1] ;                x7 << Points2_OneXtwoY[z][0] ;                y7 << Points2_OneXtwoY[z][2] ;                }           }           AtomicCurve1.setSamples(x6.data(),y6.data(),x6.size());           AtomicCurve2.setSamples(x7.data(),y7.data(),x7.size());`
To copy to clipboard, switch view to plain text mode

So in my plot i can't have a point for x6 or x7 with a value less than 0.002, but in my plot i have a value less than 0.002

http://imageshack.us/photo/my-images/804/myplot.jpg/
Last edited by 21did21; 2nd July 2011 at 01:42.

3. Uwe
Expert
Join Date
Feb 2006
Location
Munich, Germany
Posts
3,291
Thanked 876 Times in 824 Posts
Qt products
Platforms

## Re: improve the auto scaling of axis

Originally Posted by 21did21
So in my plot i can't have ...
Of course you can - your debug code is wrong.

Uwe

4. Intermediate user
Join Date
May 2011
Posts
122
Thanks
34
Platforms

## Re: improve the auto scaling of axis

=> if i put this condition (less than 0.002) so i shouldn't have a value less than this 0.002 in my plot

5. Uwe
Expert
Join Date
Feb 2006
Location
Munich, Germany
Posts
3,291
Thanked 876 Times in 824 Posts
Qt products
Platforms

## Re: improve the auto scaling of axis

Uwe

6. Intermediate user
Join Date
May 2011
Posts
122
Thanks
34
Platforms

## Re: improve the auto scaling of axis

thank, but yes i know this but it don't resolve my problem

i just put z=1 for the first loop because i don't want to plot first value
Qt Code:
`for (int z=1;z<timeNb6;z++)`
To copy to clipboard, switch view to plain text mode

7. ## Re: improve the auto scaling of axis

So where do you check the other values to make sure they are not < 0.002? You only check the [z][0] element.

And do you clear all of your x, y arrays before pushing new data into them?

8. ## The following user says thank you to d_stranz for this useful post:

21did21 (7th July 2011)

9. Intermediate user
Join Date
May 2011
Posts
122
Thanks
34
Platforms

## Re: improve the auto scaling of axis

my problem is solve:

in fact, i did not clear vector before push. So now it's works nice