gnuplot trasparent渐变背景

时间:2016-01-13 16:01:00

标签: plot gnuplot

我想在gnuplot中使用透明渐变背景。在我的剧本中,我有一些箭头。但问题是,当我有背景时,箭头不会显示。这是没有背景的代码:

<div id='contentBox'>
  <div class='article'></div>
  <div class='article'></div>
</div>

这是输出: Plot without background

当我使用以下代码添加背景(我需要渐变背景)时,箭头消失了。

set arrow from x1_l, 0 to x1_l, 1.0 nohead lc rgb 'red'
set arrow from x1_r, 0 to x1_r, 1.0 nohead lc rgb 'red'

plot  "..\\Points.txt" using 1:2 t "Point" lc rgb "blue"

此外,我想要一个情节,其中渐变背景将有两条红线。我怎么能这样做?

实施例: Background in a region

提前致谢。

1 个答案:

答案 0 :(得分:2)

使用front关键字:

set arrow from x1_l, 0 to x1_l, 1.0 nohead lc rgb 'red' front
set arrow from x1_r, 0 to x1_r, 1.0 nohead lc rgb 'red' front

set object 1 rectangle from x1_l, 0 to x1_r, 1.0 fc rgb "cyan" fs solid 1.0 front 

获取线条内的渐变:

set table 'shadowkey.dat'
splot [x1_l:x1_r] [0:1] x/(xh-xl)
unset table

最好在直线和渐变之间留一个空格:

set table 'shadowkey.dat'
my_val=(x1_r-x1_l)/20
splot [x1_l+my_val:x1_r-my_val] [0:1] x/(xh-xl)
unset table

Here you can find an alternative way to create gradients