交换对象';在gnuplot中具有“front”键的s层
我避免自己冗长乏味的代码,只关注重要的事情。我用这两条线生产交换对象';在gnuplot中具有“front”键的s层,gnuplot,Gnuplot,我避免自己冗长乏味的代码,只关注重要的事情。我用这两条线生产 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 下图中的黑色圆圈和白色区域(这是一堆箭头)(只有一个就足够了) 因为在两个对象上:箭头和圆圈
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
),对象的绘制顺序是:标签前面的箭头在对象前面(矩形、圆、椭圆、多边形)。据我所知,除非使用multiplot,否则不能在箭头前画圆。如果我没弄错你的问题,你想在箭头前画一个圆圈。所以,您可能必须使用multiplot
大概是这样的:
### 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
给出如下内容:
### 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