Gnuplot:如何在数据集和图形之间填充 space
Gnuplot : How to fill space between dataset and graph
我有一个包含 X、Y 散乱数据的数据文件,我想以某种方式(图案、固体透明等)填充这些点之外的 space。
我试过 filledcurves
关闭但它填满了内部,而不是外部
有没有办法在不将数据点分成几行并设置填充 above/below 轴的情况下填充 space?
谢谢
要实现这样的效果,您可以先创建一个代表所需背景的矩形,然后在其顶部用白色绘制数据:
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"
是否可以选择 post 使用 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')
这是结果:
我有一个包含 X、Y 散乱数据的数据文件,我想以某种方式(图案、固体透明等)填充这些点之外的 space。
我试过 filledcurves
关闭但它填满了内部,而不是外部
有没有办法在不将数据点分成几行并设置填充 above/below 轴的情况下填充 space?
谢谢
要实现这样的效果,您可以先创建一个代表所需背景的矩形,然后在其顶部用白色绘制数据:
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"
是否可以选择 post 使用 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')
这是结果: