我避免使用我自己的长而无聊的代码,只关注什么问题。我用两条线制作
set arrow from xarr_1, yarr_1 to xarr_2, yarr_2 nohead lc 'white' lw 2 front
set object circle at xarr_2, yarr_2 size screen 0.01 fc rgb "black" fillstyle solid 1.0 front
在下面的图中黑色圆圈和白色区域(这是一堆箭头)(只有一个是足够的)因为在两个对象上:箭头和圆圈,我使用密钥front
将它们放在plot
命令前面,我我想现在黑色物体位于箭头“白色区域”的前面。
我怎样才能做到这一点?
PS:无论你是否交换命令,这个简化代码都会出现同样的问题
reset session
reset
PI = 4.*atan(1.)
set xrange [-PI:PI]
set arrow from -0.1, 0.1 to 0.1, -0.1 lc 'black' lw 2 front
set object circle at 0, 0 radius 0.1 fillstyle solid 1.0 fc rgb 'red' front
plot sin(x) w l
pause -1
如果检查gnuplot手册(help layers
),则会有一定的顺序如何绘制对象:对象前面的标签前面的箭头(矩形,圆形,椭圆形,多边形)。据我了解,除非您使用多重绘图,否则无法在箭头前绘制圆圈。如果我理解你的问题,你想在箭头前面放一个圆圈。所以,你可能不得不使用多重时隙。
像这样的东西:
### plot circle in front of an arrow
reset session
set obj 999 rect from graph 0, graph 0 to graph 1, graph 1 fc rgb "black" behind
set print $Data # create some random data
do for [i=1:1000] { print sprintf("%g %g", invnorm(rand(0)), invnorm(rand(0)))}
set print
set xrange[-3:3]
set yrange[-3:3]
set multiplot
set arrow 1 from -1,1 to 1,-1 lc 'white' lw 3
plot $Data u 1:2 w p pt 7 ps 1 lc rgb "red"
set object 1 circle at 0,0 radius 0.5 fillstyle solid 1.0 fc rgb 'blue' front
unset obj 999 # don't use the black background again
plot -10 not # plot some dummy out of range
unset multiplot
### end of code
给出这样的东西: