Gnuplot:如何填充数据集和图形之间的空间

Gnuplot:如何填充数据集和图形之间的空间,gnuplot,fill,Gnuplot,Fill,我有一个包含X,Y散乱数据的数据文件,我想以某种方式(模式,实心透明,等等)填充这些点之外的空间。 我尝试了filledcurvesclosed,但它填充的是内部,而不是外部 有没有一种方法可以在不将数据点分成几行的情况下填充空间,并在轴的上方/下方设置填充 谢谢要实现这样的效果,您可以先创建一个表示所需背景的矩形,然后用白色在其上绘制数据: set xr [-2:2] set yr [-2:2] set object rectangle from -2,-2 to 2,2 fc rgb "

我有一个包含X,Y散乱数据的数据文件,我想以某种方式(模式,实心透明,等等)填充这些点之外的空间。

我尝试了
filledcurves
closed,但它填充的是内部,而不是外部

有没有一种方法可以在不将数据点分成几行的情况下填充空间,并在轴的上方/下方设置填充


谢谢

要实现这样的效果,您可以先创建一个表示所需背景的矩形,然后用白色在其上绘制数据:

set xr [-2:2]
set yr [-2:2]
set object rectangle from -2,-2 to 2,2 fc rgb "red" fillstyle solid 1.0
plot 'test.dat' w filledcurves lc rgb "white"

是否可以选择使用Imagemagick对绘图进行后期处理?然后,您可以生成两个图像,其中一个具有透明度,然后将它们按如下方式组合:

# Generate some example data.
set table "heatmap.dat"
set isosamples 1000,100
splot x
unset table

set table "ellipse.dat"
set parametric
plot 8*sin(t),5*cos(t)
unset parametric
unset table

# Set this explicitly to let the borders of the two plots match exactly.
set lmargin at screen 0.1
set rmargin at screen 0.85
set bmargin at screen 0.1
set tmargin at screen 0.9
set xrange [-10:10]
set yrange [-10:10]

# We are going to produce a png file
set terminal pngcairo

# First plot of the heatmap, this will be the background.
set output "a.png"
plot "heatmap.dat" with image


# Plot again, we need the dummy heatmap for the color key.
# We use the rectangle object for filling the area outside the ellipse. (Thanks @ewcz)
# Later we interprete the color 444444 as transparent.
set output "b.png"
set object rectangle from -10,-10 to 10,10 fc rgb "#f0ddaa" fillstyle solid 1.0
plot "heatmap.dat" using 1:2:(NaN) with image notitle,\
     "ellipse.dat" using 1:2 with filledcurves lc rgb "#444444" notitle


# Overlay the pictures using imagemagick. The result is "result.png".
system('convert b.png -transparent "#444444" c.png')
system('composite -compose atop c.png a.png result.png')
结果是:


这样可以,但问题是我必须在热图前面填充该区域,因此如果我用纯色填充,则无法看到下面的热图