
Chapter II-12 — Graphs
II-299
Evenly-Spaced Waterfall Plot Example
In this example we create a waterfall plot with evenly-spaced X and Y values that come from the X and Y
scaling of the matrix being plotted.
Function EvenlySpacedWaterfallPlot()
// Create matrix for waterfall plot
Make/O/N=(200,30) mat1
SetScale x,-3,4,mat1
SetScale y,-2,3,mat1
mat1=exp(-((x-y)^2+(x+3+y)^2))
mat1=exp(-60*(x-1*y)^2)+exp(-60*(x-0.5*y)^2)+exp(-60*(x-2*y)^2)
mat1+=exp(-60*(x+1*y)^2)+exp(-60*(x+2*y)^2)
// Create waterfall plot
NewWaterfall /W=(21,118,434,510) mat1
ModifyWaterfall angle=70, axlen= 0.6, hidden= 3
// Apply color as a function of Z
Duplicate mat1,mat1ColorIndex
mat1ColorIndex=y
ModifyGraph zColor(mat1)={mat1ColorIndex,*,*,Rainbow}
End
Unevenly-Spaced Waterfall Plot Example
In this example we create a waterfall plot with unevenly-spaced X and Y values that come from separate
1D waves.
Function UnvenlySpacedWaterfallPlot()
// Create matrix for waterfall plot
Make/O/N=(200,30) mat2
SetScale x,-3,4,mat2 // Scaling is needed only to generate
SetScale y,-2,3,mat2 // the fake data
mat2=exp(-((x-y)^2+(x+3+y)^2))
mat2=exp(-60*(x-1*y)^2)+exp(-60*(x-0.5*y)^2)+exp(-60*(x-2*y)^2)
mat2+=exp(-60*(x+1*y)^2)+exp(-60*(x+2*y)^2)
SetScale x,0,0,mat2 // Scaling no longer needed because we will
SetScale y,0,0,mat2 // use X and Y waves in waterfall plot
// Make X and W waves
Make/O/N=200 xWave = 10^(p/200)
Make/O/N=30 yWave = 10^(p/30)
// Create waterfall plot
NewWaterfall /W=(21,118,434,510) mat2 vs {xWave,yWave}
ModifyWaterfall angle=70, axlen= 0.6, hidden= 3
5
4
3
2
1
0
43210-1-2-3
3
2
1
0
-1
-2
Komentáře k této Příručce