2012-07-15 81 views
5

如何为主网格(xtics,ytics)定义一种格式并为次要的网格(mxtics和mytics)定义另一种格式?Gnuplot网格格式xtics mxtics

我想:

set style line 100 lt 1 lc rgb "gray" lw 2 
set style line 101 lt 1 lc rgb "gray" lw 1 
set grid xtics ytics ls 100 
set grid mxtics mytics ls 101 

但这需要最后定义LW(1)对所有的网格。

+0

这有点令人困惑,因为网格只在主要的tic标记处绘制。 – mgilson 2012-07-15 23:35:43

回答

1

在gnuplot的,电网仅在主要抽动标记的位置绘制,但是,如果你想有两个不同的网格,您可以使用箭头:

set style line 101 lt 1 lc rgb "gray" lw 1 
dx=.1 #grid spacing in x 
set for [i=1:10] arrow from graph i*dx,graph 0 to graph i*dx,graph 1 nohead front ls 101 
set xrange [0:1] 
plot sin(x) 
4

的轻微抽动mxtics和mytics也被画出来,但是与主要抽搐相同的格式。当你想区分它们时,这是一个问题。你用箭头解决了这个问题,但我发现首先绘制小剔号并用箭头替代主剔号更容易。坦克。

set style line 100 lt 2 lc rgb "blue" lw 1 
set style line 101 lt 1 lc rgb "gray" lw 1 

# first draw the minor tics 
set xrange [0:1] 
set mxtics 10 
set yrange [0:1] 
set mytics 5 
set grid mxtics mytics ls 101 

# then the main tics 
dx=0.2 #grid spacing in x 
set for [i=1:5] arrow from graph i*dx,graph 0 to graph i*dx,graph 1 nohead front ls 100 
dy=0.2 #grid spacing in y 
set for [i=1:5] arrow from graph 0,graph i*dy to graph 1,graph i*dy nohead front ls 100 

plot sin(x) 
2

gnuplot还将在轻微抽动使用set grid mxtics mytics绘制网格线。

要为主要网格线和次要网格线设置不同的线样式,使用正确的语法(用逗号从细微线条样式分离的主要线条样式):

set style line 100 lt 1 lc rgb "blue" lw 2 
set style line 101 lt 1 lc rgb "gray" lw 1 
set grid mxtics mytics ls 100, ls 101 
4
set style line 100 lt 1 lc rgb "gray" lw 2 
set style line 101 lt 0.5 lc rgb "gray" lw 1 

set grid mytics ytics ls 100, ls 101 
set grid mxtics xtics ls 100, ls 101 

这真的作品:)。