ハック攻撃!
set term pngcairo truecolor size 300,300 font "Arial,12"
set out 'plot.png'
# x,y min/max and center
xmin = -10
xc = 0
xmax = 10
ymin = -2
yc = 0
ymax = 2
# default borders
tm = 1
bm = 1
rm = 4
lm = 4
# arrow scale factor to cover last tic
af = 1.05
set arrow from xc,yc to xmin*af,yc filled size 0.6,30
set arrow from xc,yc to xmax*af,yc filled size 0.6,30
set arrow from xc,yc to xc,ymax*af filled size 0.6,30
set arrow from xc,yc to xc,ymin*af filled size 0.6,30
set multiplot layout 2,2
## Plot 1, top left
set key top left
set xr [xmin:xc]
set yr [yc:ymax]
set tmargin tm
set bmargin 0
set rmargin 0
set lmargin lm
set border 9
unset ytics
set xtics nomirror
plot sin(x)
## Plot 2, top right
unset key
set xr [xc:xmax]
set lmargin 0
set rmargin rm
set border 3
set ytics nomirror
replot
## Plot 3, bottom left
set xr [xmin:xc]
set yr [ymin:yc]
set bmargin bm
set tmargin 0
set lmargin lm
set rmargin 0
set border 12
unset tics
replot
## Plot 4, bottom right
set xr [xc:xmax]
set lmargin 0
set rmargin rm
set border 6
set ytics nomirror
replot
unset multiplot
私はこの出力を得る:
あなたはzeroaxis
オプションに見えるかもしれません、と述べました。デモはhereです。悲しいことに、このオプションは軸をゼロに描画するのではなく、その位置に線を置くだけです。
私の方法は「効率的です」とは言いませんが、ほとんどの作業はreplot
コマンドによって行われるので、プロットされている関数/データを変更することとは別に、これを目的に合わせて変更することはあまりありません。 gnuplotに軸の終わりに矢印を付けるか、軸がネイティブに描かれる場所を変更するオプションはわかりません。
+1。 'set zeroaxis'は1つのコマンドで両方の軸が原点を通るように見えます。軸に必要な太さと線種を指定することもできます: 'set zeroaxis linewidth 2 linetype 1'など – Umang
まず、x2ticsを解除し、y2ticsを解除することができます。それ以外の場合は、2回表示されたすべての目盛りを取得します。 – d3dave