Search code examples
gnuplotfence-plots

Gnuplot - Trying to create a waterfall/ fence plot


I try to create a nice waterfall map with gnuplot showing the development of an optical spectrum with current. My goal is to achieve something close to this :

A waterfall plot

I have tried this command

splot [][1160:1200][-80:-30] "Waterfall.txt" u 1:2:3 w l lw 3 lc rgb 'black' 

The "Waterfall.txt" file has the format suggested in the accepted answer here Gnuplot: fence plot from data. I have ignored z-data values lower than -80, substituting them with NaN.

The outcome is shown in the next image link.

My attempt

As you can see, compared with the previous figure, this is confusing to the reader. How can I fix it in order for it to be close to the first image and thus more clear to the viewer ?

Edit:

Thanks to @Ethan's answer it worked. The outcome is shown in the figure below. The only problem is the transparency of each fence, that reveals partially the subsequent fences.

The new attempt


Solution

  • Assume twenty 2D files each containing Y and Z:

    Gnuplot version 5.2

      filename(i) = 'silver.dat'
      set pm3d scansauto
      set style fill solid noborder
      set xyplane at 0
      set log z
      unset key
      splot for [k=20:1:-1] filename(k) using 1:(k):2:(1.0):2 with zerrorfill \
            fc "white" lc "black" lw 2
    
    • I don't have your data files so I use the same file 20 times for the purpose of illustration. It is based on the zerror demo in the gnuplot distribution and online demo set.
    • Note that the base of each 'fence' is set to (z=1.0) rather than zero because of the log scale on z.
    • The figure shown was made using a newer gnuplot. It uses partial transparency and a fancier bounding box that isn't in 5.2 enter image description here