gnuplot:用图像绘图,如何添加轮廓

gnuplot: plotting with image, how to add a contour

我有以下场景:我使用 with image 绘制数据以绘制强度级别图。他们已经装箱了。现在我正在寻找一种方法来绘制相同的数据,以便我可以获得等高线图。我想要这样做,以便我可以将此图用作另一个图的叠加层,以便人们看到那里的强度级别。

我知道使用线是可能的,但是我必须首先根据数据创建线,同时识别每个强度级别的边界。我希望有一种更直接的方法可以用 gnuplot 实现这一点。

为了形象化我想要在这里实现的示例图,使用 with image:

为此,我想得到如图所示的轮廓 here

数据格式如下:

0 0 36
0 1 36
0 2 36
0 3 36
0 4 36

每行包含:XCoord YCoord IntensityLevel

我想要实现的是从相同的数据中绘制出一个图,它为我提供了强度级别的等高线(这样我也可以决定使等高线拉伸两个或更多强度级别)。有没有办法在不生成新数据的情况下实现这一点?

您可以使用 table 来生成带有 splot 的轮廓。这些方面的内容:

set contour
unset surface
set cntrparam levels auto 20 # Modify this to your liking
# I'm not sure this is actually needed
set view map
unset clabel
#
set table "contours.dat"
splot "data.dat" u 1:2:3 not
unset table
unset contour

plot "data.dat" u 1:2:3 w image not, "contours.dat" u 1:2 lc 0 w l not

我放了很多等高线 (20) 这样你就可以看到效果了。对于轮廓选项,请尝试 help set cntrparam.

另一种可能性是直接使用 splot ... with pm3d 而不是 plot ... with image,但如果您使用基于矢量的终端,由于文件大小,这可能是不可取的。