不幸的是,当两个填充多边形相互接触时,由于文档查看器中的抗锯齿功能,这是一个伪影。这种情况发生在filledcurves
绘图风格,它组成了许多四边形的填充区域,以及pm3d
样式(正如您在颜色框中看到的那样,它显示了相同的工件)。也可以看看使用 gnuplot pm3d 和 pdf 输出生成的图像中存在有问题的莫尔图案。具体的演示案例。
有一个解决方法,但是非常麻烦。您必须使用一些脚本生成一个填充的多边形对象,填充它,使用stats
要确定范围,请绘制一个空图(参见例如Gnuplot - 如何获得没有意义的图形? (我只想有轴、标题以及 x 和 y 标签)).
我假设您有一个包含三列的数据文件,并且您将使用以下命令绘制它们
plot 'test.dat' using 1:2:3 with filledcurves
使用以下非常粗略的 python 脚本
from __future__ import print_function
from numpy import loadtxt
import sys
M = loadtxt(sys.argv[1])
print('set object 1 polygon ', end='')
for i in range(0,len(M)):
if (i == 0):
print('from {0},{1} '.format(M[i][0], M[i][1]), end='')
else:
print('to {0},{1} '.format(M[i][0], M[i][1]), end='')
for i in range(len(M)-1,-1,-1):
print('to {0},{1} '.format(M[i][0], M[i][2]), end='')
您可以使用以下命令绘制填充曲线
# determine the autoscaling ranges
set terminal push
set terminal unknown
plot 'test.dat' using 1:2, '' using 1:3
set terminal pop
set xrange [GPVAL_X_MIN:GPVAL_X_MAX]
set yrange [GPVAL_Y_MIN:GPVAL_Y_MAX]
eval(system('python script.py test.dat'))
set object 1 polygon fillstyle solid noborder fillcolor rgb 'red'
plot NaN notitle
这还没有涵盖锯齿状颜色框的问题:(