2017-06-12 227 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年推出!)。