Combine two 3D Waterfall plots

Hi guys,

 

i having a little trouble with the waterfall plot. I managed to make two Waterfall Plots by using the inbuilt Waterfall Packáge. Windows-->New-->Packages-->Waterfall

 

One of these Waterfalls is my raw data, the other one are the fitted data. Now my problem is to show the right raw with the right fitted data in one waterfall plot. Is there a way to do this? 

 

Thanks a Lot!!

 

 

two waterfalls.PNG

Waterfall plots are kind of limited. As you have found, there is no "AppendWaterfall" operation in Igor.

I suggest you need to use a Gizmo plot. You may need to do some work to get what you need, but it will be superior to a waterfall plot.

Here are more details that may help you get started.

I assume that you are starting from a matrix of values that you would otherwise display in a standard waterfall plot.  You need to convert this matrix into a triplet wave that is used by Gizmo path object.  Here is how I create the triplet wave:

Function matrixToGizmoPathTriplet(inMat)
    Wave inMat
   
    // sanity checks:
    Variable type=WaveType(inMat)
    if(type==0)
        doAlert 0,"Bad input wave."
        return 0
    endif
    if(DimSize(inMat,2)>0)
        doAlert 0,"Bad input dims."
        return 0
    endif
    // build fixed name output:
    Variable rows=DimSize(inMat,0)
    Variable cols=DimSize(inMat,1)
    Variable newRows=(rows+1)*cols
    Make/O/N=(newRows,3) waterfallPathTriplet
    Make/O/FREE/N=(rows) xwave=DimOffset(inMat,0)+p*dimDelta(inMat,0)
    Variable i,j,yy,count=0
    for(i=0;i<cols;i+=1)
        yy=DimOffset(inMat,1)+i*dimDelta(inMat,1)
        for(j=0;j<rows;j+=1)
            waterfallPathTriplet[count][0]=xwave[j]
            waterfallPathTriplet[count][1]=yy
            waterfallPathTriplet[count][2]=inMat[j][i]
            count+=1
        endfor
        // add terminating segment NaN:
        waterfallPathTriplet[count][0,2]=NAN
        count+=1
    endfor
End

Next I create a blank Gizmo and add a path object.  You can execute the following commands on the command line or manually add the object using the GUI:

Newgizmo
AppendToGizmo path=root:waterfallPathTriplet,name=path0
ModifyGizmo ModifyObject=path0,objectType=path,property={ pathColorType,3}

At this point you should be able to see your waterfall plot.

Since you hinted at having data and fits I would recommend using the above code for the fits and displaying the measured data as a scatter object.

If you are not sure how to proceed or if you encounter any difficulties, feel free to send a copy of your experiment (or sufficiently similar data) to support@wavemetrics.com.

 

A.G.

If you want to try to combine the two plots before trying out the superior gizmo version, here's how you might do it:

Save a recreation macro for Graph 2, and open the procedure window to see the macro.

Change any instances of  'display' to 'appendtograph'.

Bring the Graph 1 to the front, then execute the commands from the recreation macro needed to add and format the second set of traces: select the appendtograph and modifygraph commands, right click, and select execute. There may be some other complications that I haven't anticipated, but this should be a quick way to add the traces with matching offsets and formatting.

Tony- a waterfall plot is made by NewWaterfall, and there is no AppendWaterfall. Igor is simply not prepared to put two waterfall plots on one graph.

In reply to by johnweeks

johnweeks wrote:

Tony- a waterfall plot is made by NewWaterfall, and there is no AppendWaterfall. Igor is simply not prepared to put two waterfall plots on one graph.


Oh, I see. I had previously used an ancient waterfall package that simply created offsets to make a poor-person's waterfall, but I see now that the waterfall package is already more advanced than that.

Or less advanced :)

It seems like with Gizmo available, a waterfall plot is really a poor second choice these days. But there is a barrier to adopting Gizmo :)