PDA

View Full Version : improve the auto scaling of axis



21did21
1st July 2011, 17:55
Hello,

now, i plot curve with a logarithmic X axis:



myplot->setAxisScaleEngine(QwtPlot::xBottom, new QwtLog10ScaleEngine)


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?

21did21
2nd July 2011, 01:42
excuse me for this thread
=> i have a 0 for the first value it's the problem

see you ;)

Added after 1 25 minutes:

finally i haven't already a problem:

i use this to plot my curve:

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.siz e());
AtomicCurve2.setSamples(x7.data(),y7.data(),x7.siz e());

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 :mad:

Please see my curve result

http://imageshack.us/photo/my-images/804/myplot.jpg/

Uwe
2nd July 2011, 11:50
So in my plot i can't have ...
Of course you can - your debug code is wrong.

Uwe

21did21
2nd July 2011, 13:14
thank you for your answer, but i haven't understand it :o

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

Uwe
3rd July 2011, 07:13
C/C++ arrays start with index 0.

Uwe

21did21
3rd July 2011, 10:21
thank, but yes i know this but it don't resolve my problem :o

i just put z=1 for the first loop because i don't want to plot first value

for (int z=1;z<timeNb6;z++)

d_stranz
7th July 2011, 16:53
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?

21did21
7th July 2011, 19:26
my problem is solve:

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

thanks for your help