2017-06-12 49 views
0

我有下面的脚本在gnuplot中运行正常(不幸的是我有一个旧版本,现在我不能做太多的事情,它是4.0)。在gnuplot中添加网格

set xlabel "y" 
set ylabel "rw[j]" 
set title "P-D diagram" 
set zeroaxis 

set xzeroaxis 
plot [0.5:1] \ 
-5.71429*x title "L[-5]" linetype 1, \ 
-4.28571*x title "U[-5]" linetype 3, \ 
-4.71429*x title "L[-4]" linetype 1, \ 
-3.28571*x title "U[-4]" linetype 3, \ 
-3.71429*x title "L[-3]" linetype 1, \ 
-2.28571*x title "U[-3]" linetype 3, \ 
-2.71429*x title "L[-2]" linetype 1, \ 
-1.28571*x title "U[-2]" linetype 3, \ 
-1.71429*x title "L[-1]" linetype 1, \ 
-0.285714*x title "U[-1]" linetype 3, \ 
-0.714286*x title "L[0]" linetype 1, \ 
0.714286*x title "U[0]" linetype 3, \ 
0.285714*x title "L[1]" linetype 1, \ 
1.71429*x title "U[1]" linetype 3, \ 
1.28571*x title "L[2]" linetype 1, \ 
2.71429*x title "U[2]" linetype 3, \ 
2.28571*x title "L[3]" linetype 1, \ 
3.71429*x title "U[3]" linetype 3, \ 
3.28571*x title "L[4]" linetype 1, \ 
4.71429*x title "U[4]" linetype 3, \ 
4.28571*x title "L[5]" linetype 1, \ 
5.71429*x title "U[5]" linetype 3 
pause - 1 

下面的照片(我知道...这是相当糟糕的,但不要紧,现在...)。 enter image description here

我想要做的就是添加一种网格,如果我使用grid命令xticksyticks设置等等,但是我得到一个网格,当我进行网格不缩放以及缩放(即它取决于窗口而不是全局坐标系)。

我想要做的是为每个dy = 0.5设置行,例如类似于dx = 0.25。这是因为间距以及整个脚本是使用小型C++程序派生的。无论如何要实现这一目标?

+0

可能重复的[Gnuplot网格格式xtics mxtics](https://stackoverflow.com/questions/11492903/gnuplot-grid-format-xtics-mxtics) – opisthofulax

回答

2

网格线的位置与(主要和次要)tic标记的位置有关。如果你想确定自己的间距,你可以尝试

set ytics 0.5 
set grid y 

如果是太多tic标记为你的口味,你可以用较小的标志来代替:

set ytics 2 
set mytics 4 
set grid y my 

至少这是它是如何工作的最近版本的gnuplot(版本4.0在2004年推出!)。