Behaviour of getaxis

Hello,

I experienced some strange behaviour of the  getaxis command when used in a function.
I want to use it to get the automatically set interval of the bottom axis of a graph that contains several traces. In a second step I then want to use the variable V_max to re-scale the axis.

The graph has 24 waves plotted all on the left and bottom axis. The problem now is that  getaxis if called inside my functionalways returns V_max as if only the first wave plotted was present. Although the axis in the graph has a different range.

Since I don't understand which command may be the troublemaker I paste all of the code. Getaxis is called at the end of the function.


function plot()

    variable i
    variable count = 24

    wave x_value_0,y_value_0,z_value_0


    display/W=(117,194.75,719.25,491.75) y_value_0 vs x_value_0
    ModifyGraph zColor(y_value_0)={z_value_0,-10,0,Rainbow,1}


    for(i=1;i<count;i+=1)
        wave x_vaue = $"x_value_"+num2str(i)
        wave y_value = $"y_value_"+num2str(i)
        wave z_value = $"z_value_"+num2str(i)

        appendtograph y_value vs x_value
    execute "ModifyGraph zColor(y_value_"+num2str(i)+")={z_value_"+num2str(i)+",-10,0,Rainbow,1}"

    endfor

    ModifyGraph lsize=1.5
    ModifyGraph mirror=1,standoff=0,tick=2

    ColorScale/F=0/E/A=MT/C/N=text0  vert=0 ,heightPct=5, "colorscale description"  

    TextBox/C/N=text1/F=0/A=LT/E=2 "\\f01"+getdatafolder(0)

    wave y_value_10
    make/O/N=1 y_10,x_10
    wave y_value_10,x_value_10
    y_10 = y_value_10[0]
    x_10 = 0
   
    appendtograph y_10 vs x_10
    ModifyGraph mode(y_10)=3,marker(y_10)=18,rgb(y_10)=(0,0,0)

    SetAxis/R left 1000,150
    Label left "axis label left"

    getaxis/W=$"" bottom
    setaxis bottom 0,1.1*V_max
     


    ModifyGraph highTrip(bottom)=100000
    ModifyGraph minor(bottom)=1
    Label bottom "axis label bottom"


end


In this example the maximum value of x_value_0 is 14431.9 and getaxis bottom returns this number as V_max although the true V_max is 20278 which happens to be the maximum value occuring in all x_value waves, in that particular case of x_value_2.

The strange thing is that running  getaxis bottom in the command window immediately after running plot() will give me the correct result, the maximum value of the autoscaled bottom axis, but inside the function plot() it will return the value for the first wave only. This behaviour does not change when I modify the order of the waves in the graph. getaxis always seems to refer only to the one plotted first.

Any hint would be greatly appreciated. Thanks a lot in advance.
Sorry, I should have mentioned that I am using Igor Version 6.2 beta 3 on Windows XP Pro
I just wrote the function with the newest beta version, thus, I don't know how it would behave with the latest stable release.

Kangaroo
Quote:
The problem now is that getaxis if called inside my functionalways returns V_max as if only the first wave plotted was present.


You may need to call DoUpdate in the loop to force Igor to update all of its internal structures before calling GetAxis.
Thanks for posting this! I was so baffled because my function worked when I called it from the command line after creating the graph, but not from another function that creates the graph! But doUpdate fixes it.