Gnuplot: paving a path over a surface

I want to plot a path over a 3d surface in gnuplot, but I cannot figure out how. The 3D surface is generated by a function that I can display with a contour plot, and the path is a series of [x, y, f (x, y)] data points that I can display with a palette of lines (so the value from f (x, y ) changes the color of the line. But is there a way to overlay the line on the contour plot? I can't seem to get it to work. Thanks in advance.

+3


source to share


1 answer


It should be pretty simple ... Here's a small example script with a data file:

data file ( test.dat

):

.1 .1
.2 .2
.3 .3
.4 .4
.5 .5
.6 .6

      

Image script:



set yrange [0:1]
set xrange [0:1]
f(x,y) = sin(x*10)*cos(y*10)
splot f(x,y),'test.dat' u 1:2:(f($1,$2)) w lines

      

If you want to color the line segments according to the palette:

splot f(x,y),'test.dat' u 1:2:(f($1,$2)):(f($1,$2)) w lines palette

      

+2


source







All Articles