Changing the bottom axis for waterfall diagram

Hi everyone

I have a waterfall diagram, which displays a set of graphs of 'intensity' vs 'theta',

such that the bottom axis represents the unit in theta, θ.

Normally, if I have two waves named 'intensity' and 'theta',

then I can replace 'theta' with another wave called 'vector', Q.

Since Q is related to θ by:

Q = 4*pi/lamba*sin(θ*pi/180)

, then with this command

'vector' = 4*pi/lamba*sin('theta'*pi/180)


, a new graph can be displayed for 'intensity' vs 'vector'.

But as a waterfall diagram is a combination of many waves, so is there a quick way to change the unit of the bottom axis from θ to Q instead of executing the command many times for all the individual waves and re-plot the waterfall again?

Thanks for any help!

If your graph is truly a waterfall plot (made using Windows->New->Packages->Waterfall Plot) then you have just one X wave. You can change the X wave to another using

ReplaceWave/X trace=intensity, vector

If your waterfall plot is just a graph with lots of traces, use this function:
Function ReplaceAllXWavesInGraph(graph, newXWave)
    String graph
    Wave newXWave
   
    if (strlen(graph) == 0)
        graph = WinName(0,1)
    endif
   
    String tlist = TraceNameList(graph, ";", 1)
    Variable i
    Variable ntraces = ItemsInList(tlist)
    for (i = 0; i < ntraces; i += 1)
        String oneTrace = StringFromList(i, tlist)
        ReplaceWave/X/W=$graph trace=$oneTrace, newXWave
    endfor
end


Note that this function is really basic- it has no error checking, and it replaces the X wave for *all* traces in the graph regardless. It does, however, allow you to use "" as the name of the graph in order to work on the top graph window.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com