在 Gnuplot 中将一个图形的轮廓绘制到另一个图形中

Plot contours from one graph into another in Gnuplot

我有一个包含四列 X Y Z1 Z2 的数据文件,我想为每个 Z 创建一个单独的颜色图,但绘制从第一个到第二个的等高线。

首先我为 Z1 和等高线文件创建了一个图

set terminal "pdfcairo" enhanced dashed size 5,5
set output "Output1.pdf"

set pm3d 
unset surface
set view map
set contour
set cntrparam levels discrete 1.45,1.50

set table 'DATAFILE.contourZ1'
splot 'DATAFILE' using 1:2:3 notitle with lines
unset table

splot 'DATAFILE' using 1:2:3 notitle with lines

unset output

这为我提供了沿 Z1=1.45 和 1.50 的两条等高线的彩色图。到目前为止,一切都很好。将轮廓加载到我尝试的第二个图中

splot 'DATAFILE' using 1:2:4 notitle with lines,\
    'DATAFILE.contourZ1' using 1:2:3 notitle with lines

但这只给我 Z2 的色图,没有任何等高线。

有谁知道,我怎样才能做到这一点?如果无法像我尝试过的那样简单的方法,我也愿意使用其他方法:)

非常感谢!

在保存 table 文件之前,您必须 unset pm3d 才能获得仅包含 contour-line 点的文件。

然后如果你想绘制 pm3d 线你可能想使用 set pm3d explicitsplot "contour.txt" with lines, "data" with pm3d.