Gnuplot:在曲面上绘制路径 [英] Gnuplot: Plotting a path over a surface
问题描述
我想在gnuplot的3d曲面上绘制路径,但是我不知道该怎么做. 3d曲面是由一个函数生成的,我可以用等高线图显示它,而路径是可以用线调色板显示的一系列数据点[x,y,f(x,y)](因此值f(x,y)的值会更改线条的颜色,但是有没有办法在等高线图上覆盖该线条呢?我无法使其正常工作.在此先感谢.
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.
推荐答案
这应该非常简单...这是一个带有数据文件的小示例脚本:
It should be pretty simple... Here's a little example script with datafile:
数据文件(test.dat
):
.1 .1
.2 .2
.3 .3
.4 .4
.5 .5
.6 .6
绘图脚本:
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
这篇关于Gnuplot:在曲面上绘制路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!