Gnuplot:如何填充数据集和图形之间的空间 [英] Gnuplot : How to fill space between dataset and graph

查看:143
本文介绍了Gnuplot:如何填充数据集和图形之间的空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个数据文件,其中包含X,Y个分散的数据,我想以某种方式(图案,透明或其他)填充这些点之外的空间.

I have a data file with X,Y scattered data and I want to fill somehow (pattern, solid transparent, whatever) the space outside of those points.

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

I tried with filledcurves closed but it fills the inside, not the outside

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

Is there a way to fill the space without separating the data points into several lines and set fill above/below the axis?

谢谢

推荐答案

是否可以选择使用Imagemagick对图进行后期处理?然后,您可以生成两张图像,其中一张具有透明度,然后像这样将它们组合起来:

Would it be an option to post process the plots with Imagemagick? Then you could produce two images, one with transparency, and combine them later like this:

# 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')

这是结果:

这篇关于Gnuplot:如何填充数据集和图形之间的空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆