I want to plot a path over a 3d surface in gnuplot, but I can't figure out how to do it. The 3d surface is generated by a function, which I can display with a contour plot, and the path is a series of data points [x, y, f(x,y)] which I can display with lines palette (so the value of 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 manage to make it work. Thanks in advance.
3
votes
1 Answers
3
votes
It should be pretty simple... Here's a little example script with datafile:
datafile (test.dat
):
.1 .1
.2 .2
.3 .3
.4 .4
.5 .5
.6 .6
plotting 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 your line segments according to a palette:
splot f(x,y),'test.dat' u 1:2:(f($1,$2)):(f($1,$2)) w lines palette
f(x,y)
and the surface functiong(x,y)
so that we can play around with it? – mgilson